title: javascript: Internet Explorer not sending ajax call before form submit/page unload
body: <p>Trying to send AJAX POST on form submit. Already have a code working in all browsers except IE.</p>
  
  <p>Working code (except IE)</p>
  
  <pre><code>$('form').one("submit", function(e) {                   
      $.ajax(
       {
         url : url,
         type: "POST",
         data : data,
         async: false,
         complete: function() {  
         return true;
        }
       });  
      });
  </code></pre>
  
  <p>Tried almost everything I can, like onunload and onbeforeunload, and obviously the general onsubmit (both native Javascript and jQuery methods).
  But IE won't wait for AJAX calls to finish and loads the form action page.</p>
  
  <p>onbeforeunload would make it wait, but bring a dialogue confirmation box (which I am not willing to show).</p>
  
  <p>Also, async:false doesn't work on IE. I can't use HTTPRequest as the request is cross domain. Again, XDomainRequest is asynchronous, so even that is not useful.</p>
  
  <p>Other ways, like event.preventDefault() won't submit the form after callback.</p>
  
  <p>Note: The form on the page is submitted after successful validation with native submit function. I can't mess that code because it belongs to our client, and we are loading our code asynchronously.</p>
  
  <p>Already checked links:
  <a href="https://stackoverflow.com/questions/21228349/sending-a-post-request-with-javascript-on-unload-beforeunload-is-that-possible">using onbefore unload</a>
  <a href="https://stackoverflow.com/questions/9480302/onbeforeunload-with-ajax-does-not-work-with-ie">onbeforeunload with timeout</a></p>