0

I'm having some problem with IE ajax requests. The ajax requests are stopping after like 5 minutes. I've set the callback on both success and error to restart the function calling the script, it goes well for a few minutes, then suddenly crashes.

I's going like:

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

the alert function doesnt work too, so it means the .error() wasnt triggered.

  • look at this : http://stackoverflow.com/questions/3543683/jquery-ajax-timeout-setting – Pejman Jan 25 '14 at 10:26
  • It does the same with or without the timeout settings, also, the .error method should call it anyway since there is no switch for the timeout or other error occured. Just simply call the function. It does have nothing to do with the timeout, since each request take ~1 second. – Alexandru Marius Jan 25 '14 at 10:29
  • Seems that the stack is full of waiting requests. What is your sleep time? – sdespont Jan 25 '14 at 10:37
  • 1 second. It does work for some time then it suddenly stop and does nothing. Tho, in networking, it shows the reuqest isnt running until the old one was done so i guess .success is doing it's job. – Alexandru Marius Jan 25 '14 at 10:40
  • UPDATE: It seems that timeout is triggering without problems, as ive used alerts all over error. and the script continues after i press OK on the alert popup. So, the problem doesnt come from timeout. – Alexandru Marius Jan 25 '14 at 11:41

0 Answers0