我在下面有这个函数,我在循环中调用该函数 我收到 n 次警报,但只有 n-1 次或有时有 n-2 次响应
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
alert(xmlhttp.responseText);
//document.getElementById("warnings_panel").innerHTML+=xmlhttp.responseText;
}
}
alert("in ajax)
xmlhttp.open("GET","getresponse.php?start="+ start
+ "&end=" + end,true);
xmlhttp.send();
最佳答案
您似乎依赖于单个全局 xmlhttp
变量。不要那样做。
关于php - AJAX:循环发送 xmlhttp 请求...但未收到所有响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5990904/