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 >>
Subscribe
Filter by APML