Ajax Library Documentation
This documentation is provided both as pure library functionality documentation and tutorial.
Installation
Ajax library is provided as a single JavaScript file (ajax.js). The installation is as simple as copying this file to any location inside your website and reference it in your html as you would do with any JavaScript file.
Basic Usage of Ajax Library
The first thing to do to make an AJAX request is instantiante the object:
var a = new Ajax();
Now "a" is an AJAX object which is ready to make requests. Lets suppose we have a DIV with id="ajax_result".
<div id="ajax_result"></div>
If we wanted to use AJAX to fill the content of this div with the contents of, lets say, a .txt file we would do it this way:
a.doRequest("file.txt", "ajax_result");
It is as simple as that, providing that the file "file.txt" is in the same path (you could also put there the full path for the file inside your website). Just 2 lines of JavaScript code are required to get you started using AJAX. Here is the complete html source for this sample.
Constructor
Ajax()
Ajax(name)
Properties
async - Boolean
loadingElementID - String
name - String
password - String
requestHeaders - Array[]
username - String
Methods
cancelRequest()
doRequest(Param1, obj)
doRequest(Param1, Param2, obj)
getAllHeaders()
getHeader(name)
setHeader(name, value)
toString([version])
Events
onLoading()
onLoaded()
onInteractive()
onResponse(text)
onResponseDOM(DOMObj)
onDone()
onError(errCode)