title: Jquery ajax random error in Chrome only
body: <p><strong>Summary of problem</strong></p>
  
  <p>After logging in with Chrome via Forms Authentication. The landing page as returnUrl will error my jQuery ajax without hitting the server. The <code>status code = 0</code> and the <code>message = "error"</code>. (Hardly useful). Having tried Firefox and not being able to replicate the problem, I am starting to think Chrome is the issue. Clearing caches, closing and reopening does not fix. The closest article i can find is this. <a href="https://stackoverflow.com/questions/2000609/jquery-ajax-status-code-0">jQuery Ajax - Status Code 0?</a> 
  However, the URL is relative, <code>/Test</code></p>
  
  <p>Another SO article: <a href="https://stackoverflow.com/questions/1742049/jquery-ajax-problem-in-chrome?rq=1">jquery ajax problem in chrome</a></p>
  
  <p><strong>Longer description</strong></p>
  
  <p>I am getting an error with jQuery ajax. It seems that immediately after logging in with forms authentication; the landing page (returnUrl), will JS error. Then after refreshing the page (F5), the script will work (mostly). Even if not using F5, navigating to the same page using a link will allow the JS to work (mostly). So straight after login is my main testing path.</p>
  
  <p>Also, navigating in another tab to <code>/Test</code> action directly, works. The original tab still errors until i navigate or refresh it as mentioned.</p>
  
  <p>I have had times where the navigating or f5 refresh does not stop the error. Thus the use of "mostly" in the opening paragraph.</p>
  
  <p>After a day and a bit of not being able to find a solid reason through research, JS debugger, simplification of code and various scenarios; I need to request some help.</p>
  
  <p><strong>Javascript error feedback</strong></p>
  
  <p>The most I can gather is a <code>status code of 0</code> and an <code>error message of "error"</code>. </p>
  
  <p><strong>Software and versions</strong></p>
  
  <pre><code>ASP.NET MVC 3
  Chrome v28.0.1500.72 m
  jQuery v1.8.3
  AttributeRouting
  </code></pre>
  
  <p>With Chrome, I have also tried emptying the cache and CTRL+F5.</p>
  
  <p><strong>MVC</strong><br>
  I have an action protected by an <code>[Authorize(Roles = "Admin")]</code> Disabling this attribute does appear to solve my problem and then later on, not. So, sorry if any earlier statements confused. lol, short on hair!</p>
  
  <pre><code>[GET("Test")]
  public ActionResult Test()
  {
      Console.WriteLine("Test");
      return new EmptyResult();
  }
  </code></pre>
  
  <p>Any javascript script files are not behind a folder that is protected with forms authentication.</p>
  
  <p><strong>jQuery doc.ready</strong></p>
  
  <p>I have a jQuery error event which I have used to pause debugging on to see the contents of the objects.</p>
  
  <pre><code>//-- while I am using this method, I have also used the `error: ` 
  //-- part of $.ajax with the same result.
      $(function ()
      {
          $(document).ajaxError(function (event, jqxhr, settings, exception)
          {
              Debug.Log("event: " + event);
              Debug.Log("jqxhr: " + jqxhr.responseText);
              Debug.Log("settings: " + settings);
              Debug.Log("exception: " + exception);
          });
      });
  </code></pre>
  
  <p>I have a jQuery method which loads using the following events. While the followig script looks like it would slam the server. There is timing logic to ensure it only hits every 5 seconds.</p>
  
  <pre><code>$(document).on('mousemove','*',function(e){ TestMethod(this,e,'mousemove');});
  </code></pre>
  
  <p><strong>Javascript method</strong></p>
  
  <p>This is my ajax call which is as simple as I can make it.</p>
  
  <pre><code>   function TestMethod(sender, e, eventTrgger)
      {
          $.ajax(
          {
              type: "GET",
              url: '/Test',
              dataType: 'html',
              success: function (html)
              {
                  //-- tested with nothing here.
              }
          });
      }
  </code></pre>
  
  <p><strong>Fiddler</strong></p>
  
  <p>When the error occurs, Fiddler does not show a GET request, meaning the server is not hit. Also, I place a debugger breakpoint in the action confirms the action does not get hit.</p>
  
  <p><strong>Additional:</strong>
  Since the ajax call occurs every 5 seconds. While on the page and seeing status-0 and error-"error"; I clear the cache and without refreshing the page, chrome and the ajax request starts working. For the record, my chrome cache seetings are set to as little cache as I am allowed to configure.</p>