Javascript jqueryajax继续请求,并在一段时间后停止
我对IE ajax请求有一些问题。ajax请求在大约5分钟后停止。 我已经在success和error上设置了回调来重新启动调用脚本的函数,它运行了几分钟,然后突然崩溃 我想:Javascript jqueryajax继续请求,并在一段时间后停止,javascript,jquery,ajax,Javascript,Jquery,Ajax,我对IE ajax请求有一些问题。ajax请求在大约5分钟后停止。 我已经在success和error上设置了回调来重新启动调用脚本的函数,它运行了几分钟,然后突然崩溃 我想: function startBOT() { currentPlayer += 1; checkPlayerNumber(); var time = new Date(); var minute = time.getMinutes(); if(minute % 4 !=
function startBOT()
{
currentPlayer += 1;
checkPlayerNumber();
var time = new Date();
var minute = time.getMinutes();
if(minute % 4 != 0)
var runPile = "no";
setTimeout(function()
{
//startSearch
jQuery.ajax({ url: 'search_action.php?player='+currentPlayer,cache:false, async:true, timeout: 20000, dataType: "text", type: "GET", processData: false,
success:function(searchData)
{
var searchResponse = searchData.split("|");
changeAction(searchResponse[2]);
//getLog
jQuery.ajax({ url: 'log.php?act=getLast',cache:false, async:true, dataType: "text", type: "GET", processData: false,
success:function(logData)
{
var logResponse = logData.split("|");
if(String(logResponse[1]) == 'nothing')
{
logData = false;
}
else
{
jQuery("#addLogHere").prepend(logResponse[1]);
}
startBOT();
},error:function(jqXHR, textStatus, errorThrown){ alert(jqXHR.statusText);startBOT(); }, fail:function(jqXHR, textStatus, errorThrown){startBOT();}});
}, sleepTime);
}
alert函数也不起作用,因此它意味着没有触发.error()。看看这个:不管有没有超时设置,.error方法都应该调用它,因为没有超时开关或发生其他错误。只需调用函数即可。这与超时无关,因为每个请求需要约1秒的时间。堆栈中似乎充满了等待的请求。你的睡眠时间是多少?1秒。它确实工作了一段时间,然后突然停止,什么也不做。但是,在网络方面,我想这表明,在旧的一个完成之前,reuqest是不会运行的。成功在于完成它的工作。更新:似乎超时触发没有问题,因为我在所有错误中都使用了警报。在我按下警报弹出窗口上的OK后,脚本将继续。所以,问题不在于超时。