IE中的jQuery AJAX请求失败 [英] jQuery AJAX request failing in IE
本文介绍了IE中的jQuery AJAX请求失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下AJAX调用在IE中失败。
The following AJAX call is failing in IE.
$.ajax({
url:"{{SITE_URL}}/content/twitter.json",
dataType:"json",
error:function(xhr, status, errorThrown) {
alert(errorThrown+'\n'+status+'\n'+xhr.statusText);
},
success:function(json) {
...Snip...
}
});
错误函数返回
Undefined
parsererror
OK
没有请求是制作到服务器所以我认为它不是JSON的问题。
No request is made to the server so I don't think its a problem with the JSON.
已修复,请参阅#1351389
推荐答案
修复了,我从 application / json更改了内容类型; charset = utf8
只是简单的 application / json
。
我讨厌IE:)
Fixed, I changed the content-type from application/json; charset=utf8
to just plain application/json
.
I hate IE :)
同样为了避免IE超级缓存,试试这个:
Also to avoid IE super-caching try this:
var d = new Date();
$.ajax({
url:"{{SITE_URL}}/content/twitter.json?_="+d.getTime(),
...Snip...
这样每个请求都是IE获取的新网址:D
That way each request is a new url for IE to get :D
这篇关于IE中的jQuery AJAX请求失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文