把ajax放在VanillaJS中

时间:2015-08-30 08:50:29

标签: javascript ajax

如何根据状态变化暂停ajax?任何帮助将不胜感激!

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();

0 个答案:

没有答案