Prasobh E
Prasobh E

Reputation: 154

cache:false in ajax call attach a value with URl

If I set AJAX cache to false using:

$.ajaxSetup ({
cache: false });

Then my resulting AJAX URL has the characters &_=1381901096821 added to the end so that the browser (especially IE) sees it as a new page request.

The resulting call is: eg =1381901096821">http://MyServer/authcheck?=1381901096821

But I don't want that value attached with the URL. Is there any way to remove it?

Thanks in advance.

Upvotes: 1

Views: 150

Answers (1)

CodingIntrigue
CodingIntrigue

Reputation: 78595

You can set cache to true:

$.ajaxSetup ({
    cache: true
});

Then manually add no-cache headers:

$.ajaxSetup({
    beforeSend: function (xhr)
    {
        xhr.setRequestHeader("Cache-Control", "no-cache");
        xhr.setRequestHeader("Pragma", "no-cache");
    },
});

Upvotes: 1

Related Questions