Wednesday, June 5, 2024
 Popular · Latest · Hot · Upcoming
22
rated 0 times [  29] [ 7]  / answers: 1 / hits: 41438  / 11 Years ago, tue, november 26, 2013, 12:00:00

I'm currently working on a purely HTML and JavaScript driven web app that uses CORS for consuming a remote web service but currently having trouble with IE 11 making a GET request. The funny thing is we've got it working fine in IE8/9/10 just not 11.



The problem is that IE 11 appears to timeout and not wait for a response from the server. The ajax call is simply:



$.ajax(url, {
dataType: 'json',
complete: complete,
type: 'GET',
global: true,
success: success,
crossDomain: true,
xhrFields: {
withCredentials: true
}
});


In the network tab and using Fiddler I can see IE never even sends the request.



Does anyone have any ideas please?



EDIT: I forgot to mention I've already tried cache: false. I've also found something very strange in that if I switch document mode in dev tools from Edge to 9 then back again the call works everytime, even after I've cleared IE and restarted it, whether cache is true or false. Very bizarre. :


More From » jquery

 Answers
4

IE is famous for caching. Make sure you are not getting a cached response. You can either set the cache property value to false or add a unique timestamp to the url so that it will not be a cached response. You may use the $.now() method to get a unique timestamp.



Setting the cache property



$.ajax(url, {
dataType: 'json',
cache : false,
//Other things ...
}


Adding a unique timestamp to URL



var url=somePage.php?+$.now();
//Use this url now for making the ajax call


The $.now() method is a shorthand for the number returned by the expression (new Date).getTime()


[#74058] Monday, November 25, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
montana

Total Points: 675
Total Questions: 86
Total Answers: 102

Location: Mali
Member since Fri, Dec 3, 2021
3 Years ago
montana questions
Sat, Sep 19, 20, 00:00, 4 Years ago
Fri, Jan 31, 20, 00:00, 4 Years ago
Thu, Sep 12, 19, 00:00, 5 Years ago
;