title: How to cancel an ajax request in Django when new page is requested
body: <p>In my web page (built on the Django platform), I have some jQuery that requests server data via an ajax request. How do I prevent the error function from executing when I click away from the page before the ajax request has responded.</p>
  
  <p>Here is my jQuery call:</p>
  
  <pre><code>$(document).ready(function() {
   $.ajax( {
      url:'/server/url/',
      type: 'POST',
      data: {some..data},
      success:function(response) { do stuff with response },
      error: function() {alert('error')}
  });
  </code></pre>
  
  <p>How do I prevent the alert from happening when I click away from the page (to a new page)?</p>