0

IE9 ajaxクロスドメインの問題について多くの解決策をウェブで検索しましたが、解決策が見つかりませんでした。

ajax呼び出しに使用するURLは次のようになります(私のドメインはwww.domain.comのように見えるため、これはクロスドメインです)。

"http://some.domain.com/folder//api/12c63101-5d02-ab70-6e2a-4519ed75a0fd/rename?accept=json"

ajax呼び出しは次のようになります:(私はcrossDomain/typeと私が考えることができるものを追加/削除しようとしました)

$.ajax({
        url:url,
        dataType:'json',
        type: 'POST',
        crossDomain: true,
        success:function(data){}
        complete : function(data) {}})

これはchromeからの素敵な応答です(今回はリクエストが失敗したはずです):

 {errorCode: -3997, errorDescription: "[runtime][RECOVERABLE] failed, name [] taken", success: false, payload: null}

しかし、これはIE9からの奇妙な応答です

LOG: {
readyState : 0,
setRequestHeader : function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},
getAllResponseHeaders : function(){return s===2?n:null},
getResponseHeader : function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},
overrideMimeType : function(a){s||(d.mimeType=a);return this},
abort : function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this},
done : function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},
fail : function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},
progress : function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},
state : function(){return e},
isResolved : function(){return!!e},
isRejected : function(){return!!e},
then : function(a,b,c){i.done(a).fail(b).progress(c);return this},
always : function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},
pipe : function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.re,
promise : function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a},
success : function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},
error : function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},
complete : function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},
statusCode : function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},
status : 0,
statusText : "No Transport"

}

(IE9応答SCRIPT1014: Invalid characterは、明らかにJSONではないため、JSONとして解析しようとすると、コードでトリガーされます...)

「輸送なし」とは何か?クロスドメインの問題がありますか?

UTF-8?(すでに宣言されています$.ajaxSetup({ scriptCharset: "utf-8" , contentType: "application/json; charset=utf-8"});

私は絶望的です-誰かがアドバイスできますか?

4

1 に答える 1

1

設定してみてください:

jQuery.support.cors = true; // force cross-site scripting (as of jQuery 1.5)

そして、それが役立つかどうかを確認してください。

于 2012-11-14T02:06:32.460 に答える