title: ajax error handling works not as expected with CORS
body: <p>I've got another issue with CORS. I made a setup for ajax to handle some errors but the problem is now some are never triggered with cross domain requests.</p>
  
  <p>I know it is not possible to catch preflights (timeouts) because they are fired by the browser, is it? But I thought it should be possible to catch an internal server error  with the .e.g. GET after. The error handling works without CORS (turns out 500 is converted to 0)</p>
  
  <p>my setup which is never called:</p>
  
  <pre><code>jQuery.ajaxSetup({
          statusCode: {
  
              500: function (data, textStatus, jqxhr) {
  
                  if (data.status === 500) {
                      window.location.hash = "#error";
                  }
              }
          }
      });
  </code></pre>
  
  <p>the GET request:</p>
  
  <pre><code>    jQuery.ajax({
          url: url,
          type:'GET',
          timeout:1000
      }).done (function (data, textStatus, jqXHR) {
          updateCookie (jqXHR);
          Logger.log("finished loading " + log);
          callback(data);
  
      }).fail (function (data, textStatus, jqXHR) {
          Logger.log("failure loading " + log);
  
      });
  </code></pre>
  
  <p>Anybody a hint for me how to get around that problem?
  Greetings</p>
  
  <p><strong>Update:</strong> Ok debugged again and found that the fail is called but instead 0f 500 -> status 0 is returned.</p>
  
  <hr>
  
  <p>the GET request after successful preflight:</p>
  
  <pre><code>Host: localhost:8080
  User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0
  Accept: */*
  Accept-Language: de,en-US;q=0.7,en;q=0.3
  Accept-Encoding: gzip, deflate
  X-CSRF-TOKEN: 11258a06-36ea-4a21-a935-d215fcc92714
  X-Requested-With: undefined
  Origin: null
  Connection: keep-alive
  </code></pre>
  
  <p>the response from the server as expected when trying to get a resource which was deleted:</p>
  
  <pre><code>Connection: close
  Content-Language: en
  Content-Type: text/html;charset=utf-8
  Date: Mon, 08 Feb 2016 20:33:12 GMT
  Server: Apache-Coyote/1.1
  Transfer-Encoding: chunked
  statusCode: 500
  </code></pre>
  
  <p>instead of this 500 is in ajax setup status 0 called.</p>