ajax.js

Provides basic asynchronous xml call (Ajax) routines.


Functions

Constants


Ajax.command(method, target, data_func, return_func)

Sends a HTTP request to a page target. Use predefined constants to specify request type (in argument method):

Argument data_func specifies a callback to function which returns data to be sent. When response arrives, return_func(data) will be called. Example:

Ajax.user = "username";
Ajax.password = "top_secret";
var callback = function(data) { alert(data); };
Ajax.command(Ajax.GET + Ajax.AUTH_BASIC, "http://www.securesite.com/", function(){}, callback);

Ajax.manage(element, event, method, target, data_func, return_func)

Attaches Ajax call (with arguments method, target, data_func and return_func) to event fired on element.

Ajax.setStart(callback)

Specifies a function to be called when asynchronous request is being called (i.e. some user alert etc.).

Ajax.setEnd(callback)

Specifies a function to be called when last response is recieved.

Ajax.setCancel(element)

Marks element as an interruptor - when user clicks it, all Ajax calls are interrupted. Only one element can be marked this way.