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
我尝试了以下内容:
-
添加contentType:
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)
添加标题('Content-Type:application / json; charset = utf-8');
到请求
设置 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 <请求证书/ code>消息和客户端然后立即
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.
我想知道是否只有受影响的客户机具有匹配的证书和/或 withCredentials $ c在这种情况下,CORS XHR请求上的$ c>标志是相关的。
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屋!