Ajax in Simple steps.............ENJOYYYYYYYYY
Basically there are 3 things to be understood in Ajax
1) we have a request state that tells the request state after its being sent from AJAX/javascript code
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
2) A function is being called at every state of request .
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
// Get the data from the server's response
}
}
4) Get the data from the server's response
xmlHttp.responseText
Now Before all these we need 2 things more
1) get XMLHttpRequest object (its an ActiveXObject ).
2) send the request using
xmlHttp.open("GET","time.asp",true);
xmlHttp.send(null);
Basically there are 3 things to be understood in Ajax
1) we have a request state that tells the request state after its being sent from AJAX/javascript code
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
2) A function is being called at every state of request .
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
// Get the data from the server's response
}
}
4) Get the data from the server's response
xmlHttp.responseText
Now Before all these we need 2 things more
1) get XMLHttpRequest object (its an ActiveXObject ).
2) send the request using
xmlHttp.open("GET","time.asp",true);
xmlHttp.send(null);