Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm not sure this is the same problem, but in my case all of these needed to be set: onerror; onprogress; ontimeout; and onload. Here are some references that discuss the problem:</p> <ul> <li><a href="http://social.msdn.microsoft.com/Forums/ie/en-US/30ef3add-767c-4436-b8a9-f1ca19b4812e/ie9-rtm-xdomainrequest-issued-requests-may-abort-if-all-event-handlers-not-specified" rel="nofollow">http://social.msdn.microsoft.com/Forums/ie/en-US/30ef3add-767c-4436-b8a9-f1ca19b4812e/ie9-rtm-xdomainrequest-issued-requests-may-abort-if-all-event-handlers-not-specified</a></li> <li><a href="http://cypressnorth.com/programming/internet-explorer-aborting-ajax-requests-fixed/" rel="nofollow">http://cypressnorth.com/programming/internet-explorer-aborting-ajax-requests-fixed/</a></li> <li><a href="http://rudovsky.blogspot.com/2012/09/microsoft-shit-xdomainrequest.html" rel="nofollow">http://rudovsky.blogspot.com/2012/09/microsoft-shit-xdomainrequest.html</a></li> <li><a href="https://github.com/faye/faye/pull/98" rel="nofollow">https://github.com/faye/faye/pull/98</a></li> </ul> <p>There are many others as well. They're scattered and sometimes contradictory in their suggested solution. For example, one suggests wrapping the xdr.send call in a setTimeout.</p> <p>The behavior I was seeing went away by adding non-blank bodies for each of the event handler functions. I'm not sure if all are necessary. The setTimeout wrapper was definitely <em>not</em> necessary.</p> <p>One possibly irrelevant piece of info: in my case I decided to bind each handler to the 'this' object. I also added function implementations to keep my compiler from assigning them all to the same empty function. My code was using GET, not POST. YMMV.</p> <p>Your code leaves one handler unset:</p> <pre><code>if (window.XDomainRequest) // Check whether the browser supports XDR. { xdr = new XDomainRequest(); // Create a new XDR object. if (xdr) { xdr.timeout = 3000;//Set the timeout time to 3 second. xdr.onload = function () { alert("Success"); }; xdr.onerror = function () { alert("Error"); }; xdr.ontimeout = function () { alert("Error"); }; // this also needs to be set xdr.onprogress = function() { window.console.log('progress'); }; xdr.open("post", urlSearch); xdr.send(); } } else { $.ajax({ url: urlSearch, type: 'POST', dataType: 'json', timeout: 3000, success: function (data) { alert("Success"); }, error: function () { alert("Error"); } }); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload