title: AJAX redirect dilemma, how to get redirect URL OR how to set properties for redirect request
body: <p>First, I'm working in Google Chrome, if that helps. Here is the behavior:</p>
  
  <p>I send an xhr request via jQuery to a remote site (this is a chrome Extension, and I've set all of the cross-site settings...):</p>
  
  <pre><code>$.ajax({
      type: "POST",
      contentType : "text/xml",
      url: some_url,
      data: some_xml,
      username: user,
      password: pass,
      success: function(data,status,xhr){
          alert(data);
      },
      error: function(xhr, status, error){
          alert(xhr.status);
      }
  });
  </code></pre>
  
  <p>The URL that is being set returns a 302 (this is expected), and Chrome follows the redirect (also expected).</p>
  
  <p>The new URL returns a prompt for credentials, which are not being pulled from the original request, so Chrome shows a login dialog. If I put in the original credentials, I get back a response about invalid request sent (it's a valid HTTP request -- 200 -- the remote server just doesn't like one of the headers).</p>
  
  <p>When viewing the developer window in Chrome, there are two requests sent. The first is to the original URL with all settings set in the AJAX request. The second is to the redirect URL, with a method of "GET", nothing from the "POST" field, and no credentials.</p>
  
  <p>I am at a loss as to what I can do. I either need to:</p>
  
  <ol>
  <li><p>Get the redirect URL so I can send a second request (<code>xhr.getResponseHeader("Location")</code> does NOT work),</p></li>
  <li><p>Have the new redirect request preserve the settings from the original request, or</p></li>
  <li><p>Get the final URL that the error came from so I can send another request.</p></li>
  </ol>
  
  <p>Ideally I don't want the user to have to put in their credentials a second time in this dialog box, but I'll take what I can get if I can just get the final URL.</p>