title: How to have jQuery.ajax cover both error() & complete() in single clause?
body: <p>I have a slideshow that uses an ajax call to fetch my data like this:</p>
  
  <pre><code>jQuery.ajax({
      dataType: "json",
      timeout:8000,
      url:    full_fallback_uri,
      success: function(result) {
          //do stuff
      }, 
      error: function() {
          self.skip();
      }, 
      complete: function(xhr, data) {
          if (xhr.status != 200) {
              self.skip();
          }
      },                      
      asynch: false,
  });
  </code></pre>
  
  <p>So in case the ajax call fails, skip() is called in order to skip current slide.</p>
  
  <p>Now above setup doesn't work, since in the case of an error, skip() is called twice, causing a double-skip (skipping two slides not just the current one).</p>
  
  <p>And if I leave out either the 
      error()
  or the
      complete() (with the check for http status != 200)
  it's not enough, the one doesn't cover all possible errors.</p>
  
  <p>How could I write a clause that covers both error and complete cases?</p>
  
  <p>Would something like this work?</p>
  
  <pre><code>jQuery.ajax({
      dataType: "json",
      timeout:8000,
      url:    full_fallback_uri,
      success: function(result) {
          //do stuff
      }, 
      error: function() {
          this.myErrorSign = true; //DEFINING MY OWN VARIABLE ON THIS jQuery.ajax object
          this.complete(); //MANUALLY CALL THE COMPLETE FUNCTION, IN CASE THIS ISN'T DONE AUTOMATICALLY UPON FAIL
      }, 
      complete: function(xhr, data) {
          if (xhr.status != 200 || this.myErrorSign == true) { //LOOK NOT ONLY FOR STS!=200 BUT ALSO FOR THE VARIABLE THAT WAS DEFINED IN THE ERROR CASE ABOVE
              self.skip();
          }
      },                      
      asynch: false,
  });
  </code></pre>
  
  <p>Or perhaps this design will be similarly flawed, and in some cases call the skip() twice just as well?</p>