在跨域調(diào)用的IE中,Jquery $ .ajax失敗我正在使用跨域請求$.ajax。它適用于Firefox和Chrome,但不會(huì)在IE 7或8上發(fā)出呼叫。任何人都可以告訴我以下內(nèi)容有什么問題嗎?我使用了JSON和JSONP(由于一些自定義限制,我停止使用它)。我已經(jīng)Allow-access-control-origin在我的網(wǎng)站上使用標(biāo)題了。(沒有這些,Chrome和Firefox沒有成功請求。)我已經(jīng)嘗試過https://developer.mozilla.org/en/http_access_control碼:$.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);
}});我嘗試了多個(gè)網(wǎng)站上的各種提示,但還沒有運(yùn)氣。
3 回答

四季花海
TA貢獻(xiàn)1811條經(jīng)驗(yàn) 獲得超5個(gè)贊
只需安裝這個(gè)jQuery插件:用于IE8的jQuery跨域AJAX
這個(gè)1.4kb的插件可以立即在Internet Explorer 8和9中運(yùn)行。
在jQuery之后包含插件,并正常調(diào)用你的ajax請求。沒有其他要求。
插件GitHub repo和安裝說明
- 3 回答
- 0 關(guān)注
- 489 瀏覽
添加回答
舉報(bào)
0/150
提交
取消