title: jQuery ajax() using success, error and complete vs .done(), .fail() and always()
body: <p><strong>The questions</strong>:</p>
  
  <ol>
  <li>Should we change our coding as suggested below?</li>
  <li>Is there a difference between <code>.done()</code> &amp; <code>success:</code>, <code>.fail()</code> &amp; <code>error:</code> and <code>.always()</code> &amp; <code>complete:</code>?</li>
  </ol>
  
  <p><strong>The preamble</strong>:</p>
  
  <p>I was putting together a jQuery.ajax call, which I have done successfully in the past too. Something like this:</p>
  
  <pre><code>    $.ajax(
      {
          url: someUrl,
          type: 'POST',
          data: someData,
          datatype: 'json',
          success: function (data) { someSuccessFunction(data); },
          error: function (jqXHR, textStatus, errorThrown) { someErrorFunction(); }
      });
  </code></pre>
  
  <p>While taking a quick look at some documentation, I came across a reference stating that The success, error and complete callbacks are deprecated as of jQuery 1.8. To prepare your code for their eventual removal, use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.</p>
  
  <p>We should therefore start coding something like this instead:</p>
  
  <pre><code>$.ajax( "example.php" )
      .done(function (data) { someSuccessFunction(data); })
      .fail(function (jqXHR, textStatus, errorThrown) { someErrorFunction(); })
      .always(function() { alert("complete"); });
  </code></pre>