title: jQuery ajax POST causes an immediate GET to the same URL
body: <p>I'm using jQuery (1.4.2) with a Django backend and doing my development with Firefox (3.5.15) on Debian.  I'm using $.ajax() to post some data to my server, which reflects the data back to the browser.  Firefox is sending the POST, then immediately performing a GET on the same URL.  Where is this GET coming from?  I don't want it to happen.</p>
  
  <p>The code I'm using to POST looks like this:</p>
  
  <pre><code>$.ajax({
      type: 'POST',
      url: '/edit_value/',
      data: JSON.stringify(data_to_post),
      success: function(updated) {
          alert('success');
      },
      error: function(request, description, exception) {
          alert('error');
      },
      async: false,
      dataType: 'json'
  });
  </code></pre>
  
  <p>I see the success alert message and not the error alert message.  Looking at my server logs, I am echoing back data_to_post correctly.</p>
  
  <p>I've watched tcpdump and see the POST request.  It looks exactly as I would expect:</p>
  
  <pre><code>POST /edit_value/ HTTP/1.1
  Host: localhost:8000
  User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.15) Gecko/20101028 Iceweasel/3.5.15 (like Firefox/3.5.15)
  Accept: application/json, text/javascript, */*
  Accept-Language: en-us,en;q=0.5
  Accept-Encoding: gzip,deflate
  Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  Keep-Alive: 300
  Connection: keep-alive
  Content-Type: application/x-www-form-urlencoded; charset=UTF-8
  X-Requested-With: XMLHttpRequest
  Referer: http://localhost:8000/
  Content-Length: 30
  Cookie: csrftoken=9e3edd79a51956f088f4a505ca1b4282; sessionid=80d72430f4682632ccfb8dc8047b7d17
  Pragma: no-cache
  Cache-Control: no-cache
  
  [{"id":"161","value":"988.0"}]
  </code></pre>
  
  <p>The response looks normal too:</p>
  
  <pre><code>HTTP/1.0 200 OK
  Date: Mon, 22 Nov 2010 07:28:44 GMT
  Server: WSGIServer/0.1 Python/2.6.6
  Vary: Cookie
  Content-Type: text/json
  
  [{"id":"161","value":"988.0"}]
  </code></pre>
  
  <p>If async is set to true, sometimes the browser will hang-up the TCP connection early, sometimes the request/response completes.  By setting async to false, the request/response always completes (it was set to false for the above example).  Firefox then immediately sends a GET.</p>
  
  <pre><code>GET /edit_value/ HTTP/1.1
  Host: localhost:8000
  User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.15) Gecko/20101028 Iceweasel/3.5.15 (like Firefox/3.5.15)
  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Language: en-us,en;q=0.5
  Accept-Encoding: gzip,deflate
  Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
  Keep-Alive: 300
  Connection: keep-alive
  Referer: http://localhost:8000/
  Cookie: csrftoken=9e3edd79a51956f088f4a505ca1b4282; sessionid=80d72430f4682632ccfb8dc8047b7d17
  </code></pre>
  
  <p>Where does this GET come from?  How can I trap it in Firebug before the page reloads?  What other information can I provide?</p>
  
  <p>Thanks,
  Craig</p>