title: in jquery how to call a function after an ajax request has been sent?
body: <p>How can I call my function: <code>myFunc1</code> in <code>jquery</code> after the browser has completely sent an ajax request?</p>
  
  <p>I want to run a callback function after a jquery ajax has been <strong>sent</strong>. I don't want to do this on <code>complete</code> or <code>success</code> because I don't want to wait for the request to complete. I want to fire it right after the ajax request has been sent from the browser.</p>
  
  <p>This is use case for which i need this:</p>
  
  <p>I want run a function after making an ajax request. My original code was this:</p>
  
  <pre><code>  $.ajax({url: 'x.html'});
    myFunc1();
  </code></pre>
  
  <p>In the case when `myFunc1() changes the browsers location, the browser would cancel the pending ajax request. </p>
  
  <p>My current solution is to do this:</p>
  
  <pre><code>  $.ajax({url: 'x.html', complete: myFunc1});
  </code></pre>
  
  <p>This makes sure that <code>myFunc1</code> is not called till the ajax is complete. Although this solution works, it is inefficient because <code>myFunc1</code> wont run till the request is complete. Since I don't care what the ajax request returns, whether it fails or succeeds, I dont need to wait for it to complete to run the <code>myFunc1</code> function.</p>