Monday, September 8, 2008

AJAX = Asynchronous JavaScript and XML

AJAX stands for Asynchronous JavaScript And XML.
AJAX is a type of programming made popular in 2005 by Google (with Google Suggest).
AJAX is not a new programming language, but a new way to use existing standards.
With AJAX you can create better, faster, and more user-friendly web applications.
AJAX is based on JavaScript and HTTP requests.

Internet Explorer uses an ActiveXObject, while other browsers uses the built-in JavaScript object called XMLHttpRequest.

The responseText Property

The data sent back from the server can be retrieved with the responseText property.

In our code, we will use the responseText to display result:

xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.myForm.time.value=xmlHttp.responseText;
}
}

Here are the possible values for the readyState property:
State Description

0 The request is not initialized
1 The request has been set up
2 The request has been sent
3 The request is in process
4 The request is complete

No comments: