IE10/11 Ajax XHR 错误 - SCRIPT7002:XMLHttpRequest:网络错误 0x2ef3 [英] IE10/11 Ajax XHR error - SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3
问题描述
我已经研究这个问题几天了,并在这个论坛上伸出援手,因为我觉得我已经用尽了我的选择.我有一个托管在 Drupal 7 网站上的表单,需要将表单值提交到外部 url.该表单通过 jQuery.AJAX 使用 HTTPS 协议的 POST 请求
I've been working on this problem for a few days and reaching out on this forum since I feel like I've exhausted my options. I have a form hosted on a Drupal 7 website and need to submit the form values to an external url. The form uses a POST request over the HTTPS protocol via jQuery.AJAX
- 表单在 Chrome、Firefox 和 Safari 中运行良好
- 我在 IE10+ 控制台中收到以下错误(使用 IE10+ 时,ajax 调用总是进入错误函数):
SCRIPT7002:XMLHttpRequest:网络错误 0x2ef3,由于错误 00002ef3,无法完成操作
SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3, Could not complete the operation due to error 00002ef3
我尝试了以下方法:
添加内容类型:
adding contentType:
// causes all of the jQuery callbacks to error out
"application/json; charset=utf-8",
在实际 POST 之前尝试 Ajax GET 调用(如另一个 SO 线程所建议)
attempting an Ajax GET call before the actual POST (as suggested on another SO thread)
在请求中添加了 header( 'Content-Type: application/json; charset=utf-8' );
set crossDomain: true
已添加相应的 CORS 标头,并将表单代码粘贴在下方:
The appropriate CORS headers have been added and the form code is pasted below:
$.ajax({
url: "[URL]", //the page to receive the form data
crossDomain: true,
type: "POST",
data: dataString, //posting to API
dataType: "json", //the data type the function should expect back from the server
success: function(data) {
if (data.response_status == "1") { //error for at least 1 field
//display error message
}
else {
//display thank you label next to input
}
} else {
//All form fields completed successfully! Redirect user to Thank you confirmation page
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert("there is an error!");
console.log("in error section");
console.log("jqXHR: " + jqXHR);
console.log("jqXHR.responseText: " + jqXHR.responseText);
console.log("textStatus: " + textStatus);
console.log("errorThrown: " + errorThrown);
data = $.parseJSON(jqXHR.responseText);
console.log("parseJSON data: " + data);
}
});
});
});
我读过SCRIPT7002:XMLHttpRequest:网络错误 0x2ef3,无法完成由于错误 00002ef3 导致的操作
任何指导都会有所帮助!谢谢
Any guidance would be helpful! THANKS
推荐答案
OP 提供了一个 WireShark 捕获,显示服务器使用 HTTPS CertificateRequest
消息请求证书,然后客户端立即 FIN
d 连接.
The OP provided a WireShark capture showing that the server requested a certificate using the HTTPS CertificateRequest
message and the client then immediately FIN
d the connection.
将服务器配置为不请求客户端证书后,问题就消失了.
After configuring the server not to request a client certificate, the problem went away.
使用 Fiddler 也会使问题消失,因为除非您将其配置为这样做,否则 Fiddler 永远不会从浏览器请求客户端证书.
Using Fiddler also would make the problem disappear because, unless you configure it to do so, Fiddler will never request a client certificate from the browser.
我想知道是否只有受影响的客户端机器有匹配的证书和/或 CORS XHR 请求上的 withCredentials
标志是否与这种情况相关.
I'm wondering if only the affected client machine had a matching certificate and/or whether the withCredentials
flag on the CORS XHR request is relevant in this scenario.
这篇关于IE10/11 Ajax XHR 错误 - SCRIPT7002:XMLHttpRequest:网络错误 0x2ef3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!