«JavaScript» Ajax handling class
Purpose of this class is to send http-requests to a server-side script and output the result to an element in the current document, identified by it's id.
Simple example of usage:
// create new instance
// choose where to put the result
// provide a function to handle the returned result
$http.
setHandler(function ($httpResponse, $htmlNode)
{
$htmlNode.innerHTML = $httpResponse.responseText;
// this will re-initialize the page (when needed)
if (document.body.onload) {
document.body.onload();
}
});
// send request to server
$http.
send('action=' +
'function_name' +
'&' +
$arguments);
Note: if you use the Yana SDK to create code for a new plug-in, it will automatically provide you with a ready-to-use implementation of a mock object that provides all your available PHP functions via AJAX. Also note that you don't have to change your PHP code to make it "AJAX-ready". A basic AJAX-functionality is already provided by the framework itself, so you don't necessarily need to care about this issue.