An Ajax API - Manual

Attributes and functions of the Anaa framework.

© 2007-2012 - Sandrine Takis & Denis Sureau - GNU GPL 2.0 license.

Attributes

AACaching

AACaching: Boolean

The attribute is set to true if caching is allowed, or false if it is not allowed.
You should leave it on false, but for files that are rarely modified. Disabling caching reduces performances on big files, but enabling it could produce bad results.

 

Functions

AACreate

This method is called by other methods to create an XMLHttpRequest object.

Interface:

function AACreate()

Argument: none.
Return: An XMLHttpRequest object.

AARead

Called to read a document.
The type of the document is determinated by the extension. Any extension that ends by "ml" (xml, xhtml, etc...) should be XML compatible. Other extensions are supposed to be plain text files.
A JSON file should have a json or js extension and is a text file.

Interface:

function AARead(url, callback, element)

Arguments:

Return: nothing.

AALoadXML

Load an XML file with any extension.

Interface:

function AALoadXML(url, callback, element)

Arguments

Return: nothing.

AALoadHTML

Loads the content of a HTML page into a variable or a tag in the currently displayed page. This allows to access the data of the other page by methods of the Document Object Model.
Before to call the function, you have to declare a variable or create a tag to store the content.
The function calls a user-defined function passed as argument, that processes the body of the HTML page loaded.
The param argument may be the id of a div tag where to store the extracted data.
Look at the demos for details about the use of this function.

Interface:

function AALoadHTML(url, callback, id, param)

Arguments:

return:

AAWrite

Called to send data to a script on the server.

Interface:

function AAWrite(url, data [, function] )

Arguments:

Return: nothing.

AAHead

Read the header of a file.

Interface

function AAHead(url, key, function, element)

Argument

Return: nothing

AAGetBody

Extract the content of the body tag from a string holding a web page, so got by the XHR object.

Interface:

function AAGetBody(content)

Argument:

Return: A string, the part of the page in the body tag.

License

Free, open source, under the GPL 2.0 license.
You can use the library freely, extend it if you want, but do not remove the copyright notice.