AJAX framework

This simple framework includes three javascript classes that are dealing with basic AJAX programming. Download from here.

Header class

Basically, this class is just a data-structure to hold header information.

RawAjax class

The RawAjax class has three method makeRequest, setHeader, and showHeader. setHeader and showHeader are self-explained.

makeRequest(url, parameters, callback, method, debug)
- the url of the target of request;
- or search, the string after the ? mark if a form is submitted by GET method; even if the method parameter is set to "post", provide this string as if it is "get";
- the javascript function should be called after result of the request is returned;
- either "get" or "post";
debug - optional
, either false or true.

Ajax class

The Ajax class provides five methods: makePOSTRequest, makeGETRequest, submitPOSTForm, submitGETForm, and parseForm. This class is a wrapper of the RawAjax class to provided more high-level function to developer. In this class, header inforamtion is pre-defined and hard-coded.

The following four methods are self-explained, and parameters have the same meaning with RawAjax.makeRequest.
- makePOSTRequest(url, parameters, callback, debug)
- makeGETRequest(url, parameters, callback, debug)
- submitPOSTForm(url, formObj, callback, debug)
- submitGETForm(url, formObj, callback, debug)

parseForm(formObj, debug), this method returns the GET string of a form. Currently, only input text, input password, input hidden, input checkbox, input radio, select and textarea tags are processed.
formObj - the form object need to be parsed


Server time:


To debug AJAX, the author highly recommend "FireBug".

By Dehua Zhang, June 1, 2007