title: ASP.NET MVC 4 jQuery ajax request returning my custom 404 html as a 200 response when URI not found
body: <p>I have an ajax call on a button press. If I have <code>customErrors mode="On"</code> and my ajax request URI is not found, the <code>404</code> html is being returned to the request as a <code>200</code> status. </p>
  
  <p><code>web.config</code></p>
  
  <pre><code>&lt;customErrors mode="On" defaultRedirect="/Errors"&gt;
    &lt;error statusCode="404" redirect="~/Errors/Error404" /&gt;
  &lt;/customErrors&gt;
  </code></pre>
  
  <p>JS run on button click.</p>
  
  <pre><code>$.get(api_uri, function (json) {
      console.log(json);
      options.element_to_inject.html(compiled_template(json));
      options.status_container.hide();
  }).fail(function () {
      options.status_container.hide();
      options.element_to_inject.html("Error").show();
  });
  </code></pre>
  
  <p>My controller method being called by my AJAX request.</p>
  
  <pre><code>public JsonResult Get(int? id)
  {
      // Do work
  }
  </code></pre>
  
  <p><code>console.log(json)</code> as shown above is outputting my <code>404</code> html. If I turn <code>customErrors mode="Off"</code> then I get back an actual <code>404</code> response code as needed.</p>
  
  <p>Thought: It's almost as if I need ajax requests to ignore the custom <code>404</code>.</p>
  
  <p>How with <code>customErrors mode="On"</code> can I get my request to not return the <code>404</code> html?</p>