Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
676 views
in Technique[技术] by (71.8m points)

javascript - IE10/11 Ajax XHR error - SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3

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

  • Form works fine in Chrome, Firefox, and Safari
  • I am receiving the following error in IE10+ console (and the ajax call always goes into the error function when using IE10+):

SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3, Could not complete the operation due to error 00002ef3

I've tried the following:

  • adding contentType:

    // causes all of the jQuery callbacks to error out
    "application/json; charset=utf-8",
    
  • attempting an Ajax GET call before the actual POST (as suggested on another SO thread)

  • added header( 'Content-Type: application/json; charset=utf-8' ); to the request

  • set crossDomain: true

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);                           
    }        
    });         
  });
});

I've read SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3, Could not complete the operation due to error 00002ef3

Any guidance would be helpful! THANKS

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The OP provided a WireShark capture showing that the server requested a certificate using the HTTPS CertificateRequest message and the client then immediately FINd the connection.

After configuring the server not to request a client certificate, the problem went away.

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...