title: JQuery ajax stoppen in $.when when server returns 500 error
body: <p>I make a request to a server with JQuery and the $.when method.</p>
  
  <pre><code>  $.when(ajaxRequest(param)).done(function(response){
      console.log(responseData);
    });
  </code></pre>
  
  <p>my ajax function looks like this:</p>
  
  <pre><code>function ajaxRequest(param){
    var requestedData;
    return $.ajax({
      type: 'POST',
      url: myurl,
      data: {
          setParam:param
      },
      error: function(data){
        console.log(data);
        return(data);
      }
    });
  }
  </code></pre>
  
  <p>Everything works fine if the server returns a 200 OK. But if there was something wrong the server answers with 500. How can I return the response body to the calling method?</p>
  
  <p>The errorbody is printed with console.log on the ajaxRequest method but its not returned to the calling method?</p>