78

I keep receiving this error when I do some Ajax calls...

It may even be something to do with Geocoding but I really have no idea how to capture the error to display something useful to users... or even how to solve the problem as it seems to just be referencing some kind of pointer or something :S 0x2ef3

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

An image might be more helpful than the error message:

enter image description here

Any ideas at all?

My code fires off 10 ajax calls in 1 second to be processed by geocoding server side.

The error comes up intermittently. Sometimes I get geocoded results and sometimes I get that error. I would say I get it 10% of the time. It completely stops the ajax call from firing my error handler in jQuery.

3
  • 2
    make a console.dir(request) to see the content of the XMLHttpRequest Object, check for status and readystate values and for response and responseText Commented Jan 28, 2013 at 15:22
  • 1
    Same problem here. Using https in IISExpress with self-signed certificate. Strange thing is that problem disappears when I uncheck TLS (all versions) in Advanced settings in Internet Explorer and have at least one SSL version checked.
    – Frode
    Commented Apr 26, 2016 at 20:45
  • Disable HTTP/2 protocol from IE options. stackoverflow.com/questions/56079289/disable-http2-in-ie11 Commented Nov 8, 2019 at 10:44

13 Answers 13

31

This is the fix that worked for me. There is invalid mime or bad characterset being sent with your json data causing that errror. Add the charset like this to help it from getting confused:

$.ajax({
  url:url,
  type:"POST",
  data:data,
  contentType:"application/json; charset=utf-8",
  dataType:"json",
  success: function(){
  ...
  }
});

Reference:

Jquery - How to make $.post() use contentType=application/json?

Could not complete the operation due to error c00ce56e

4
  • 5
    You are mixing two things here: Response.ContentType seems to be a server-side thing which makes sure the server includes a charset in in the content type for its response. The contentType in the $.ajax call tells the browser which content-type to use when submitting the request to the server. So one is not an alternative for the other. Commented Jun 25, 2013 at 15:31
  • 1
    Note that this error is (c00ce56e) different from the OP (00002ef3). I believe 00002ef3 is the certificate error mentioned in stackoverflow.com/a/32106649/1446634
    – Ewout
    Commented Sep 24, 2015 at 13:21
  • I see that error ID varying on the same connection attempt during my current struggle with this, so I would not assume it's anything more than some sort of offset.
    – kungphu
    Commented Nov 11, 2015 at 0:57
  • 1
    "...causing that 'errror' " Commented Aug 26, 2016 at 17:45
23

We also encountered similar problems. However, setting the charset as noted in the previous comment did not help. Our application was making an AJAX request every 60 seconds and our webserver, nginx, was sending Keep-Alive timeout at 60 seconds.

We fixed the problem by setting the keep-alive timeout value to 75 seconds.

This is what we believe was happening:

  1. IE makes an AJAX request every 60 seconds, setting Keep-Alive in the request.
  2. At the same time, nginx knows that the Keep-Alive timeout value is ignored by IE, so it starts the TCP connection close process (in the case of FF/Chrome this is started by the client)
  3. IE receives the close connection request for the previously sent request. Since this is not expected by IE, it throws an error and aborts.
  4. nginx still seems to be responding to the request even though the connection is closed.

A Wireshark TCP dump would provide more clarity, our problem is fixed and we do not wish to spend more time on it.

1
  • Setting the timeout to 60 also fixed this issue for me on two sites I manage. Glad there was a quick fix for IE on this.
    – Josh
    Commented Dec 14, 2017 at 14:34
11

I received the same error (SCRIPT7002: XMLHttpRequest: Network Error 0x80004004, Operation aborted), in our case it was because of JavaScript's same origin policy.

Our web app was making a JQuery AJAX call to our server on Port 8080. The call was getting intercepted and re-routed over SSL (due to server rules mandating that incoming traffic use SSL).

Once we made our web app load through the SSL port the issue was fixed.

1
  • How did you get your web app to load through the SSL port? Commented Apr 30, 2019 at 8:27
2

I had this problem, a an AJAX Post request that returned some JSON would fail, eventually returning abort, with the:

SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3

error in the console. On other browsers (Chrome, Firefox, Safari) the exact same AJAX request was fine.

Tracked my issue down - investigation revealed that the response was missing the status code. In this case it should have been 500 internal error. This was being generated as part of a C# web application using service stack that requires an error code to be explicitly set.

IE seemed to leave the connection open to the server, eventually it timed out and it 'aborted' the request; despite receiving the content and other headers.

Perhaps there is an issue with how IE is handling the headers in posts.

Updating the web application to correctly return the status code fixed the issue.

Hope this helps someone!

1
  • can you post the full error for reference? Network Error 0x2ef3 is a general error, which is probably followed by a more specific error code.
    – Ewout
    Commented Sep 24, 2015 at 13:36
2

This issue happened in my project because of an ajax GET call with a long xml string as a parameter value. Solved by the following approach: Making it as ajax post call to Java Spring MVC controller class method like this.

$.ajax({
    url: "controller_Method_Name.html?variable_name="+variable_value,
    type: "POST",
    data:{ 
            "xmlMetaData": xmlMetaData // This variable contains a long xml string
    },
    success: function(response)
    {
        console.log(response);
    }
  });

Inside Spring MVC Controller class method:

@RequestMapping(value="/controller_Method_Name")
  public void controller_Method_Name(@RequestParam("xmlMetaData") String metaDataXML, HttpServletRequest request)
{
   System.out.println(metaDataXML);
}
0
1

I had this error for some time and found a fix. This fix is for Asp.net application, Strange it failed only in IE non compatibility mode, but works in Firefox and Crome. Giving access to the webservice service folder for all/specific users solved the issue.

Add the following code in web.config file:

 <location path="YourWebserviceFolder">
  <system.web>
   <authorization>
    <allow users="*"/>
   </authorization>
  </system.web>
 </location>
1

I have stumbled across this questions and answers after receiving the aforementioned error in IE11 when trying to upload files using XMLHttpRequest:

var reqObj = new XMLHttpRequest();

//event Handler
reqObj.upload.addEventListener("progress", uploadProgress, false);
reqObj.addEventListener("load", uploadComplete, false);
reqObj.addEventListener("error", uploadFailed, false);
reqObj.addEventListener("abort", uploadCanceled, false);

//open the object and set method of call (post), url to call, isAsynchronous(true)
reqObj.open("POST", $rootUrlService.rootUrl + "Controller/UploadFiles", true);

//set Content-Type at request header.for file upload it's value must be multipart/form-data
reqObj.setRequestHeader("Content-Type", "multipart/form-data");

//Set header properties : file name and project milestone id
reqObj.setRequestHeader('X-File-Name', name);

// send the file
// this is the line where the error occurs
reqObj.send(fileToUpload);

Removing the line reqObj.setRequestHeader("Content-Type", "multipart/form-data"); fixed the problem.

Note: this error is shown very differently in other browsers. I.e. Chrome shows something similar to a connection reset which is similar to what Fiddler reports (an empty response due to sudden connection close).

Also, this error appeared only when upload was done from a machine different from WebServer (no problems on localhost).

1

I just want to add what solved this problem for me, as it is different to all of the above answers.

The ajax calls that were causing the problem were trying to pass an empty data object. It seems IE does not like this, but other browsers don't mind.

To fix it I simply removed data: {}, from the ajax call.

1
  • for me, removing body: {} fixed it.
    – smurf
    Commented Mar 2, 2018 at 19:29
1

With the Apache 2 change KeepAliveTimeout set it to 60 or above

0

Upping the directive in the virtualhost for KeepAliveTimeout to 60 solved this for me.

0

Have encountered the same issue in my asp.net project, in the end i found the issue is with the target function not static, the issue fixed after I put the keyword static.

[WebMethod]
public static List<string> getRawData()
1
  • 2
    This is very specific to your application's requirements. the use of "static" is not going to be specifically related to this message. Perhaps try investigate more into what the actual problem was. That would be awesome!
    – Jimmyt1988
    Commented Apr 7, 2017 at 9:38
0

Incase none of these solutions were "clear" enough, essentially IE/Edge is failing to parse your "data" field of your AJAX call properly. More than likely you're sending an "encoded" JSON object.

What Failed: "data": "{\"Key\":\"Value\"}",

What Works: "data":'{"Key":"Value"}'

0

[SOLVED]

I only observed this error today, for me the Error code was different though.

SCRIPT7002: XMLHttpRequest: Network Error 0x2efd, Could not complete the operation due to error 00002efd.

It was occurring randomly and not all the time. but what it noticed is, if it comes for subsequent ajax calls. so i put some delay of 5 seconds between the ajax calls and it resolved.

2
  • 2
    It's hard to imagine a scenario where delaying ajax calls for "5 seconds" would be a reasonable solution to this. Commented Aug 23, 2018 at 15:26
  • @ChiefTwoPencils, exactly same is my stand..! but this is what solved my issue after digging so much over the IE official help pages. I didn't found any helpful clue. basically, it's an IE bug but no logical solution. if you find it please update me too.
    – Amit Shah
    Commented Aug 23, 2018 at 16:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.