The XMLHttpRequest object has a property named onreadystatechange that handles asynchronous loading operations.


xmlHttp.onreadystatechange= function() { }

The readyState property tells you how the data loading is going. Here are the possible values the readyState property can take. Those are 0,1,2 and 4.

0 means uninitialized
1 means loading
2 means loaded
3 means interactive
4 means complete (i.e., all data downloaded from the back end page).

  
xmlHttp.onreadystatechange= function() { if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById('lbl1').innerHTML = xmlHttp.responseText; //alert(xmlHttp.responseText); } else { document.getElementById('lbl1').innerHTML = 'Sorry, try again'; } } xmlHttp.send();

Even you can pass the paramers to the backend page.

        var pars = 'name=' + name;
        xmlHttp.send(pars);
    

<< Previous Next >>

Recent Articles

CLR integartion in SQL Server
Create, Read and Write Files in .Net
Message Queue in .Net
Deploy Asp.Net Web Site
Queues in Vb.Net
If you have any queries or doubts post at Forum
Share on Facebook
Responses(post your response or comments below)
Name *

Email * (won't be published)

Response *