title: How to make a request which returns a fake response in JavaScript?
body: <p>Within my code I want to catch some POST request errors. To test this, I want to fake the response of the POST request. Is there a way I can do this in JavaScript?</p>
  
  <pre><code>$.ajax({
      url: url,
      type: 'POST',
      // further arguments
  }).done(function (result) {
      // Sunny day
  }).fail(function(result) {
      // Catch it!
  });
  </code></pre>
  
  <p>I want a statuscode to be returned other than 200 as a response</p>