跨域AJAX调用Internet explorer HTTP到HTTPS
我发现,为了能够在Internet Explorer中跨域发送数据,我应该使用XDomainRequest 通过这样做,我偶然发现了下一个问题。我正在将数据从HTTP发送到HTTPS,这会导致错误脚本5:访问被拒绝。。我尝试添加headerAccess控件允许原点:*;到指定的PHP文件,但没有结果 有没有办法解决这个问题,我可以在Internet Explorer 9+中将数据从我的HTTP域发送到我的HTTPS域 我现在使用的代码给出了script5错误: 我还尝试添加$.support.cors=true;没有结果。回答我自己的问题: 我使用JSONP修复了它:跨域AJAX调用Internet explorer HTTP到HTTPS,ajax,internet-explorer,cross-domain,xdomainrequest,Ajax,Internet Explorer,Cross Domain,Xdomainrequest,我发现,为了能够在Internet Explorer中跨域发送数据,我应该使用XDomainRequest 通过这样做,我偶然发现了下一个问题。我正在将数据从HTTP发送到HTTPS,这会导致错误脚本5:访问被拒绝。。我尝试添加headerAccess控件允许原点:*;到指定的PHP文件,但没有结果 有没有办法解决这个问题,我可以在Internet Explorer 9+中将数据从我的HTTP域发送到我的HTTPS域 我现在使用的代码给出了script5错误: 我还尝试添加$.support.c
if ('XDomainRequest' in window && window.XDomainRequest !== null) {
var xdr = new XDomainRequest(); // Use Microsoft XDR
xdr.open('get', url);
xdr.onload = function () {
var dom = new ActiveXObject('Microsoft.XMLDOM'),
JSON = $.parseJSON(xdr.responseText);
dom.async = false;
if (JSON == null || typeof (JSON) == 'undefined') {
JSON = $.parseJSON(data.firstChild.textContent);
console.log(JSON);
}
successCallback(JSON); // internal function
};
xdr.onerror = function() {
_result = false;
};
xdr.send();
}
$.ajax({
url: url,
data: thedata,
dataType: 'jsonp',
jsonp: 'callback',
jsonpCallback: 'jsonpCallbackFunc',
success: function (response) {
}
});