In your json object returned by the server you will have several 'key': 'value' of these elements you are going to spend what you want and get a callback function for javascript. Specifically, if you click on a button:
Code:
/ / Your function ajax will be the next
$.ajax({
dataType: "json",
url: 'ajax / test.html',
success: function(data) {
if (data.callback) eval(data.callback + '(' + Data.result + ')' );
}
});
/ / Your server will return data in JSON format
/ / Eg ( "result": "Totto is nice", "callback": "myfunc")
/ / When you RECOVERED this server you must have a function myfunc () as follows
function my_function(result)
{
alert(result);
}
Bookmarks