在跨域调用的IE中,Jquery $ .ajax失败
我正在使用跨域请求$.ajax。它适用于Firefox和Chrome,但不会在IE 7或8上发出呼叫。任何人都可以告诉我以下内容有什么问题吗?
我使用了JSON和JSONP(由于一些自定义限制,我停止使用它)。
我已经Allow-access-control-origin在我的网站上使用标题了。(没有这些,Chrome和Firefox没有成功请求。)
$.ajax({
type: 'GET',
url: "http://anotherdomain.com/Service/GetControl?id=" + zoneID,
cache: false,
contentType: "application/x-www-form-urlencoded",
async: false,
beforeSend: function (request) {
//alert('before send');
//request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
//request.setRequestHeader("X-PINGOTHER", "pingpong");
} ,
success: function (data, status) {
//alert("Data returned :" + data);
//alert("Status :" + status);
if (status == "success" && data != "")
$("#" + div.id).append(data);
else
$("#" + div.id).attr("style", "display:none;");
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
alert(errorThrown);
}});我尝试了多个网站上的各种提示,但还没有运气。
HUX布斯
相关分类