Passing callback parameters to setTimeout() does not work in IE?

I used the code in js setTimeout function it is working in firefox ;i,e it is reloaded with in seconds. but not working in IE. I changed the method as 'POST', but not request not supported then it changed again in to 'GET'. Any solution ?

function getCallDetails(cId){
    $.ajax( {
        url : 'callInfo.html?cId='+cId,
        method : "GET",
         dataType: "json",     
        success : function(data) {
        callResult=data.rows;

        showCallDetails(callResult,cId);
        },
        failure : function(form, action) {
        }
    });
    window.setTimeout(getCallDetails, 1000,[cId]);

}

Upvotes: 2

Views: 3211

Answers (4)

this is due to cache problem in IE

this is solved by

 function getCallDetails(cId){
        $.ajax( {
            url : 'callInfo.html?cId='+cId+'&randomNo='+ Math.rand(),
            method : "GET",
             dataType: "json",     
            success : function(data) {
            callResult=data.rows;

            showCallDetails(callResult,cId);
            },
            failure : function(form, action) {
            }
        });
        window.setTimeout(function() { getCallDetails(cId); }, 1000);


    }

and random no ignored @ server side.

Upvotes: 2

Phil Klein
Phil Klein

Reputation: 7514

Try the following instead:

window.setTimeout(function() { getCallDetails(cId); }, 1000);

Also I would move that line into the success callback.

Upvotes: 6

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100195

Try:

window.setTimeout(function() {
    getCallDetails(cId);
}, 1000);

Hope it helps

Upvotes: 4

SLaks
SLaks

Reputation: 887807

You're using a non-IE-compatible version of setTimeout.
In IE, there is no way to pass parameters to the callback.

Also, calling setTimeout there is very wrong; you will get exponentially more concurrent requests because each call generates two more calls.

Upvotes: 6

Related Questions