Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is a repost of the following SO question because I'm pretty convinced that this is a networking/server issue, and not something wrong with my code.

http://stackoverflow.com/questions/7842530/ie-9-30-second-ajax-post-requests

Here's the gist: When making an AJAX request in IE9 (and the 7/8 compatibility modes) via GET or POST the following events occur:

  1. Within 500ms, my server responds (Rails/Apache/Phusion Passenger)

  2. IE immediately sees the body of the response (as shown in the Developer Tools Network Tab)

  3. IE then waits until the timeout period has passed before it shows the headers (again in the Dev Tools) and notifies my Javascript.

As stated in the SO question, it looks like my server (or perhaps the networking layer in Windows 7) isn't closing the request until the timeout period has passed.

It works perfectly in all other browsers that I have tested. Does anyone have any idea why this might be happening?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Okay, so after much screwing around, I found out that sending an AJAX GET request a few hundred milliseconds after the POST seems to fix the issue. Not sure why, but it seems to close the previous connection first and let it finish.

So, my solution is as follows:

didSend: function(request, response) {
  if (SC.browser.msie && request.get('type') === "POST") {
    setTimeout(function() {
      Core360.Request.getUrl('/test_server').send();
    }, 500);
  }
}

And everything appears to work. I would still love to find out the actual problem, but seeing as the XMLHttpRequest object is waiting to call readystatechanged for some stupid reason...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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