ajax calls

Permalink
hi
i made a Single Page contain a combo box, when user change the combo, i should get something from db & insert into a DIV via ajax call.
i wonder how should i handle the situation. i tried to make another Single Page, but every Single page contain header,footer,..., so a full page load into inner div.
I just want to insert some content, javascript,... into that DIV.

shahroq
 
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
You need an action in your controller or a 'tool' to respond to the ajax call and return the value from the database.

This is probably best protected from fraudulent use by the validation helper.

The easiest jQuery ajax method to use is 'load', as this will take the return from the tool and replace the contents of a dom element with it (so the tool needs to return text or an html fragment).

It was written for c5.4.x, but have a look at http://www.concrete5.org/documentation/how-tos/developers/ajax-less...
and the associated lessons addon. (The method of loading dialogs is not using the much easier methods of c5.5+)