IE中HTTPS Ajax请求的问题(非跨域)
我对仅在 IE 中进行 HTTPS Ajax 调用时遇到的问题感到困惑。 IE 似乎认为我正在发出跨域请求,但事实并非如此。从页面 https://mydomain/customer_profile.php
调用以下代码:
$.ajax({
type: 'post',
url: 'https://mydomain/ajax/retrieve_transaction_details.php',
data: /* my data is here */,
success: function(response){
// do something with the response
},
error: function (xhr, ajaxOptions, thrownError){
alert(xhr.status);
alert(thrownError);
}
});
此请求在除 IE 之外的所有浏览器中都可以正常工作。在 IE 中,错误函数返回“错误:访问被拒绝”。就像我说的,我完全被难住了,所以任何见解或想法都会很棒。
I'm stumped on an issue I'm having with an HTTPS Ajax call in IE only. IE seems to think I'm making a crossdomain request, but I'm not. The following code is called from the page https://mydomain/customer_profile.php
:
$.ajax({
type: 'post',
url: 'https://mydomain/ajax/retrieve_transaction_details.php',
data: /* my data is here */,
success: function(response){
// do something with the response
},
error: function (xhr, ajaxOptions, thrownError){
alert(xhr.status);
alert(thrownError);
}
});
This request works just fine in every browser except IE. In IE, the error function returns "Error: Access is denied". Like I said, I'm completely stumped on this, so any insight or ideas would be great.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我猜您正在 HTML 的 head 部分中使用
标记;正确的?如果它指向
http
而不是https
,则会破坏 IE。I guess you are using the
<base>
tag inside the head section of your HTML; right?If it is pointing to
http
instead ofhttps
, that would break IE.尝试在您的请求中将 crossDomain 设置为 true,如下所示:
这应该允许您发出请求,无论它是否跨域。
try setting crossDomain to true in your request like this:
this should allow you to make the request regardless of whether it is cross-domain or not.