title: "Aftersend" event for Ajax calls?
body: <p>$.ajax calls a PHP page that perform many operations.
  I want my users can close the page after the PHP script received the request.</p>
  
  <p>How do I know when the script has received the request?</p>
  
  <p>Something like...</p>
  
  <pre><code>$.ajax({
      url: "/my-huge-script", 
      type: "POST",
      ...
      ...
      afterSend: function(){
          alert('The script has received the request. You can close the browser.');
      }
  }
  </code></pre>
  
  <p>Thanks in advance and sorry for my bad english.</p>
  
  <h2>UPDATE</h2>
  
  <p>I tried:</p>
  
  <p>JS:</p>
  
  <pre><code>$.ajax({
      url: "/huge-page",
      dataType: "json",
      type: "POST",
      data: { 
          ... LARGE DATA! (base64 file)
      },
      success: function() {
          alert('The script has received the request. You can close the browser.')
      }
  })
  </code></pre>
  
  <p>HUGE-PAGE.php</p>
  
  <pre><code>&lt;?php
  header('Content-Type: application/json');
  echo json_encode(array('Success' =&gt; "get it"));
  
  ... MANY operations ...
  
  ?&gt;
  </code></pre>
  
  <p><strong>But 'success' fires only at the end of the PHP script..</strong></p>
  
  <p>The $_POST data that are sent to the PHP page vary in size, for this reason I want users to know when the request was done... without waiting the end of the PHP script.</p>