title: Extracting HTTP Headers from HTTP 300-code responses using Ajax
body: <p>I am performing an Ajax request to a server that accepts cross-domain requests but for which I have no control over the server code. My desire is to extract an HTTP Link header from the response. As an example:</p>
  
  <pre><code>$.ajax({
   url: theURL
  }).done(function(data,textStatus,xhr){});
  </code></pre>
  
  <p>hits a server that responds with the following (as observable when the URL is queried with curl):</p>
  
  <pre><code>HTTP/1.1 302 Found
  Link: &lt;http://thedataIwant.com&gt;;rel="foo"
  Location: http://someothersite.com
  </code></pre>
  
  <p>The browser follows the HTTP 3XX code and I get the contents of the HTTP headers from <a href="http://someothersite.com" rel="nofollow">http://someothersite.com</a> in the <code>done()</code> handler; however, I would like to first extract the contents of the Link header for the initial HTTP response with the 3XX code. </p>
  
  <p>How do I go about extracting the contents of the HTTP Link header from an HTTP response with 3XX status code?</p>