我已经浏览了所有关于此的 stackoverflow 帖子,但仍然无法弄清楚它为什么不起作用。
我有一个简单的 jquery ajax 帖子,可以在除 ie8 和 ie9 之外的任何地方使用。
服务器是asp.Net
Index.html 有:
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
jQuery帖子:
$.ajax({
// cache: false,
// crossDomain: true,
// contentType: "application/json; charset=utf-8",
type: "POST",
url: self.dom.API+"/api/xxx/InsertUser",
dataType: "json",
data: postData,
success: function(data){
if(data.Status == "Success"){
self.onSubmitSuccess();
}
else{
self.unknownError();
}
},
error: function(data){
}
});
我还添加了这个插件来解决 Xdomin 安全问题。 https://github.com/jaubourg/ajaxHooks/blob/master/src/xdr.js
通过查尔斯的错误和响应
Response: {"Message":"An error has occurred."}
POST /api/xxx/InsertUser HTTP/1.1
Accept */*
Origin http://local.xxx.com
Accept-Language en-US
Accept-Encoding gzip, deflate
User-Agent Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
Host xxx-api.xxx.com
Content-Length 206
Pragma no-cache
URL http://xxx-api.xxx.com/api/xxx/InsertUser
Status Complete
Response Code 500 Internal Server Error
Protocol HTTP/1.1
Method POST
Content-Type application/json; charset=utf-8
Client Address /127.0.0.1
Remote Address xxx.com/ipaddress