Microsoft Vista Software | Microsoft Vista Books | Linux Books | Ubuntu Books | Ruby On Rails Books

Sunday, January 22, 2006

XMLHttpRequest, Make Asynchronous Requests With JavaScript And Ajax

IBM has posted their second Mastering Ajax article named: Mastering Ajax, Part 2: Make asynchronous requests with JavaScript and Ajax.
These are the parts of the article

Web 2.0 at a glance
This part explains what web 2.0 is and gives example of sites that are part of it

Introducing XMLHttpRequest
This part is a small introduction to XMLHttpRequest and shows how to use the following methods and properties
open(): Sets up a new request to a server.
send(): Sends a request to a server.
abort(): Bails out of the current request.
readyState: Provides the current HTML ready state.
responseText: The text that the server sends back to respond to a request.
It also explains how do deal with Microsoft browsers

Sending requests with XMLHttpRequest
This part deals with opening and sending requests and also how to set a callback method. There is also a teaser on asynchronicity

Handling server responses
This part is about callbacks, HTTP ready states (see below)
0: The request is uninitialized (before you've called open()).
1: The request is set up, but hasn't been sent (before you've called send()).
2: The request was sent and is being processed (you can usually get content headers from the response at this point).
3: The request is being processed; often some partial data is available from the response, but the server hasn't finished with its response.
4: The response is complete; you can get the server's response and use it.

In conclusion
Article Conclusion

Resources
A couple of links to learn, get products and technologies and discuss Ajax
If you are a developer and are using or planning to use Ajax then this is a must read

No comments: