[英]$.ajax not working in IE9
I have the following code that is working on Chrome and Firefox, but not in IE9 我有以下适用于Chrome和Firefox的代码,但不适用于IE9
$.ajax({
type : type,
url : url,
data : reqData,
crossDomain: true,
cache: false,
dataType : dataType,
contentType : contentType,
success : successFunction
}).fail(function() {
showError("IE9!");
});
type is POST, dataType is JSON and contentType is application/json All the other parameters are correct 类型为POST,数据类型为JSON,内容类型为application / json所有其他参数均正确
I've tried removing the contentType, removing the cache, setting cache to true, nothing seems to work 我尝试删除contentType,删除缓存,将缓存设置为true,但似乎无济于事
Any thoughts? 有什么想法吗? Thanks in advance
提前致谢
您不能在其中使用普通ajax进行跨域访问,即您必须为此使用XDR,请参考此链接
Check the url path ( should be absolute ) and make it unique adding a timestamp for example 检查url路径(应该是绝对的),并使其唯一,例如添加时间戳记
var url = 'http://mydomain.com/' ** not '/' **
var timestamp = new Date()
var uniqueUrl = url + (uri.indexOf("?") > 0 ? "&" : "?") + "timestamp=" + timestamp.getTime()
then 然后
url : uniqueUrl,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.