28 December 2005

AJAX Tutorial

AJAX :: Asynchronous Javascript And XML

AJAX is based on XMLHttpRequest

With this object we can assign actions to occur at specific properties like

Properties of XMLHttpRequest


Values for readyState :

0 = Uninitialized ; 'open' is not yet called
1 = Loading ; 'send' for request is not yer called
2 = Loaded ; 'send' is called, headers & status are available
3 = interactive ; downloading response
4 = Completed ; finished downloading response

responseText : Response as Text OR null if readyState < 3

responseXMl : Response as DOM document object OR null if readyState < 3

status : Integer HTTP status code

statusString : Status String

Methods of AJAX
Basic Methods

1) open(method, url [,async])

- initializes a new HTTP request
-method : GET, POST, PUT, DELETE
-url : http url
-async : true/false

2) send(body)

-Sends HTTP request

3) abort()

-Called after 'send' to cancel the request

Header Methods

4) void setRequestHeader(name, value)

5) String getResponseHeader(name)

6) String getAllResponseHeaders()

Enjoy AJAXing ...


1 comment:

STC Technologies said...

Pretty much. By using the programming practice termed "Ajax" you will be able to trade data, with a web server, without having to load a new page. Instead of Ajax being seen as "The New Way to Develop Websites", it should instead be seen as another weapon to add to your programming arsenal.STC Technologies|STC Technologies