簡體   English   中英

$ .ajax在IE9中不起作用

[英]$.ajax not working 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!");
});

類型為POST,數據類型為JSON,內容類型為application / json所有其他參數均正確

我嘗試刪除contentType,刪除緩存,將緩存設置為true,但似乎無濟於事

有什么想法嗎? 提前致謝

您不能在其中使用普通ajax進行跨域訪問,即您必須為此使用XDR,請參考此鏈接

檢查url路徑(應該是絕對的),並使其唯一,例如添加時間戳記

var url = 'http://mydomain.com/'   ** not '/' **
var timestamp = new Date()
var uniqueUrl = url + (uri.indexOf("?") > 0 ? "&" : "?") + "timestamp=" + timestamp.getTime()

然后

url : uniqueUrl,

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM