一段时间后jQuery ajax继续请求停止

时间:2014-01-25 10:13:06

标签: javascript jquery ajax

我对IE ajax请求有一些问题。 ajax请求在5分钟后停止。 我已经设置成功和错误的回调来重新启动调用脚本的函数,它会好几分钟,然后突然崩溃。

我想:

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

警报功能也不起作用,因此意味着没有触发.error()。

0 个答案:

没有答案
相关问题