[英]Proxy to connect to XML cross server..Using Ajax works on some browsers not others? code included
[英]Cross server AJAX Request - Works in all browsers but IE
遇到一些問題讓我的跨服務器請求在IE中工作。 有可能嗎? 我已經閱讀了跨服務器請求,它似乎完全取決於瀏覽器。 如果我在任何其他瀏覽器欄IE中運行下面的函數,它將返回'success'函數,IE只返回'error'函數。
我的問題是,是否有可能讓它在IE中恢復“成功”?
我已將我的JS代碼刪除到以下內容:
jQuery.support.cors = true;
$.getJSON($this.attr('action'))
.error(function() {
console.log('ERROR');
}).success(function() {
console.log('success');
});
謝謝,克里斯蒂安
為了執行跨域AJAX請求,您需要通過附加'callback =?'來發出JSONP請求。 到你的網址。
記錄錯誤消息
$.getJSON($this.attr('action'))
.error(function(jxhr) {
console.log(jxhr.status+" --- "+jxhr.responseText);
}).success(function(data) {
console.log('success');
});
這個console.log(jxhr.status+" --- "+jxhr.responseText);
是什么console.log(jxhr.status+" --- "+jxhr.responseText);
line在IE中說也嘗試指定contentType
類的
$.ajaxSetup({
cache: false,
crossDomain: true,
contentType: "application/json; charset=utf-8"
});
希望這會有所幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.