title: How to detect Ajax call failure due to network disconnected
body: <p>I am sending lots of data using jquery ajax method to web sever and client side respond only after receiving acknowledgment from server, now suppose network connection lost in MIDDLE of ajax  call then how to detect this situation.</p>
  
  <pre><code>$.ajax({
           url:'server.php',
           data:'lots of data from 200KB to 5MB',
           type:'post',
           success: function(data)
                      {
                          alert('Success');
                        //some stuff on success
  
                      },
            error: function(XMLHttpRequest, textStatus, errorThrown)
                      {
                          alert('Failure');
                        //some stuff on failure
                      }
          });
  </code></pre>
  
  <p>This is my code and and it does not give error in middle of ajax call if get internet is disconnected.</p>
  
  <p>NOTE : I cant use time out because data size is vary from 200kb to 5MB and server response time calculation is not feasible.</p>