JSL.ajax

This class has all the ajax functions. Based on jxs(V2.01.A) - http://www.openjs.com/scripts/jx/

JLS.ajax Source Code

Arguments

 * URL
 * the url of the page to be loaded

JSL.ajax.load( callback, format, method )
This loads the URL provided in the constructor and calls the 'callback' user function with the data from the URL as its argument.

Arguments

 * callback
 * Function that must be called once the data is ready.


 * format
 * The return type for this function. Could be 'xml','json' or 'text'. If it is json,           the string will be 'eval'ed before it is returned it. Defaults to 'text'.


 * method
 * GET or POST. Defaults to 'GET'.

JSL.ajax.bind( options )
bind is one all encompassing function for ajax. The first argument is an associative array and different details can be passed as that argument. First this hash must be created...

Then it can be passed on to the bind like this...

The possible option values are listed below.

Arguments

 * options
 * A associative array with these possible values.
 * options['onSuccess'] - Function that should be called at success - ie. readyState=4 and status=200
 * options['onError'] - Function that should be called at error
 * options['format'] - Return type of the ajax data - could be 'xml','json' or 'text'. If none is specified, it will default to 'text'
 * options['method'] - This decides with method should be used in sending the data - 'GET' or 'POST'. Defaults to 'GET'
 * options['update'] - If the ID of a valid element is given here, then the ajax call will be made, the data fetched and fed into this element using innerHTML.
 * options['loading_indicator'] - The id of the loading indicator. This will be set to display:block when the url is loading and to display:none when the data has finished loading.
 * options['loading_text'] - HTML that would be inserted into the document once the url starts loading and removed when the data has finished loading. This will be inserted into a div with class name 'loading-indicator' and will be placed at 'top:0px;left:0px;'