title: Get jQuery post redirect response
body: <p>I've written some HTML/Javascript that sits on a third-party server for security reasons.  This page performs a javascript post to another page on the same site.  However, instead of responding with useful data, it instead wants to perform a redirect (if you would post via a normal HTML form to this page, it would redirect your browser).  How can I process this process?  I basically want to be able to extract the url's query parameters that it is trying to redirect with (and then put this link into a hidden form field).</p>
  
  <p>Here is my basic ajax post...</p>
  
  <pre><code>$.ajax({
      url: '/someurl/idontcontrol', 
      data: serialized_form_data,
      async: false,
      type: 'POST',
      success: function(data, textStatus, x) {        
          alert(x);
          alert(x.getAllResponseHeaders());
          return false;
          $('#redirect_link').val(WHAT_DO_I_PUT_HERE);
      }
  });
  </code></pre>
  
  <p>Note that the URL I am posting to is not one that I control, so I have no power over what it returns.</p>
  
  <p>UPDATE: When I use the above alerts, I receive "[object XMLHttpRequest]" and "null".  I'm monitoring the headers with a Firefox plugin and they seem be coming back as expected, but I can't seem to access them via javascript (I've also tried x.getResponseHeader('Location'), but that and all other calls to getResponseHeader return empty).</p>
  
  <p>ALSO: I don't know if it matters, but the status code is 302 (as opposed to 301 or 303).</p>
  
  <p>Thanks!</p>