How to put ajax on hold based on the state change? Any help will be appreciated!
var myRequest = new XMLHttpRequest();
myRequest.onreadystatechange = function(){
var state = myRequest.readyState,
//if state === 2 wait for 5 secs and then continue???
}
myRequest.open("GET", "forAjax.html", true);
myRequest.send();