title: A CORS POST request works from plain JavaScript, but why not with jQuery?
body: <p>I'm trying to make a Cross Origin post request, and I got it working in plain <code>JavaScript</code> like this:</p>
  
  <pre><code>var request = new XMLHttpRequest();
  var params = "action=something";
  request.open('POST', url, true);
  request.onreadystatechange = function() {if (request.readyState==4) alert("It worked!");};
  request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  request.setRequestHeader("Content-length", params.length);
  request.setRequestHeader("Connection", "close");
  request.send(params);
  </code></pre>
  
  <p>But I would like to use <code>jQuery</code>, but I can't get it to work. This is what I'm trying:</p>
  
  <pre><code>$.ajax(url, {
      type:"POST",
      dataType:"json",
      data:{action:"something"}, 
      success:function(data, textStatus, jqXHR) {alert("success");},
      error: function(jqXHR, textStatus, errorThrown) {alert("failure");}
  });
  </code></pre>
  
  <p>This results in Failure. If anyone knows why <code>jQuery</code> doesn't work, please let us all know. Thanks.</p>
  
  <p>(I'm using <code>jQuery</code> 1.5.1, and Firefox 4.0, and my server is responding with a proper <code>Access-Control-Allow-Origin</code> header)</p>