Ajax Simplified
May 22, 2009
I use to think Ajax is very difficult, but as and when I dived into it, I realized its way too simple.
This is a small summary of Ajax from one of my presentation
So what is Ajax?
The backbone of Ajax is JavaScript, XML, HTML, CSS
The next question, how Ajax works?
JavaScript communicates directly with the server, through the JavaScript XMLHttpRequest object.
The XMLHttpRequest object have 3 properties onreadystatechange property , readyState property , responseText property.
onreadystatechange property – stores the function that will process the response from a server
readyState property – readyState property holds the status of the server’s response.
responseText property – The data sent back from a server can be retrieved with the responseText property.
Next question is how do we send response to the server?
This is done through 2 methods of XMLHttpRequest object, open and send.
open() method
takes three arguments
The first argument defines which method to use when sending the request (GET or POST).
The second argument specifies the URL of the server-side script.
The third argument specifies that the request should be handled asynchronously.
Send() method
sends the request off to the server.
Entry Filed under: Ajax, JavaScript. Tags: Ajax.
Trackback this post | Subscribe to the comments via RSS Feed