Internet Explorer cannot access JSON Web service the first time
I have encountered a problem with Internet Explorer and JSON Web Services and was wondering if anyone else has as well. Using jQuery, I tried to access a specific URL on the same domain that returns JSON data. This works perfectly on Firefox and Chrome. However, the first Ajax request always fails in Internet Explorer. What's more interesting is that subsequent Ajax requests DO work, even though the request emanates from the same function!
At first, I thought that I might have done something wrong with jQuery but ... when I tried accessing my JSON Web service URL using Internet Explorer (directly into the address bar on a new tab), it also fails the first time, and succeeds afterwards. So I thought that it might be a problem with my Web service, but then I have the same issue with Web services available freely on the Internet. Every time I open a new tab and try to access a JSON Web service, the first call always fails.
Did anyone experience the same problem with Internet Explorer and JSON Web Service? I am focusing on the wrong problem: is the issue with IE not capable of accessing the Web service irrelevant, and the problem with jQuery is somewhere else?
My AJAX call is written as follows:
$.ajax({
async: true,
type: 'GET',
url: '<JSON Web service URL>',
dataType: 'json',
cache: false, 开发者_Python百科// Doesn't help
success: function(data, textStatus, xhr) {
alert('success');
},
error: function(xhr, textStatus, error) {
alert('failure');
}
});
I've tried this on several configurations, but the problem is always there:
- Windows XP / Seven
- Internet Explorer 7 (Real and IE 8 Emulated mode) / 8
- Chrome 11
- Firefox 4
- jQuery 1.5.1 / 1.5.2
Thanks in advance,
I was facing same issue, updating jQuery to 1.6.4 solved the issue :)
精彩评论