私は yxcom から x.com への ajax リクエストを作成しています。アクセス拒否エラーが発生する IE 8 および 9 を除いて、ほとんどのブラウザーですべてが機能しています。これが私のコードです
if (!empty && radio_checked) {
$(".modal-content").animate({
height: "250px"
}), 500, function () { };
$.support.cors = true;
var url = "localhost:5603/ajax/post/sell-exm/?" //localhost for testing locally
if ($.browser.msie && window.XDomainRequest) {
var xdr = new XDomainRequest();
xdr.open("post", url+data); // *** ERROR HERE ***
xdr.send(data);
} else {
$.ajax({
type: "POST",
url: url,
data: data,
datatype: "jsonp",
success: function(r){
//nothing needed here
}
});
}
}
繰り返しますが、これは IE 8 と 9 を除くすべてのブラウザーで機能します。また、web.config に Access-Control-Allow-Origin カスタム ヘッダーを配置しています。