title: Is there a way to get all the request headers in a jQuery $.ajax call?
body: <p>I'm building a debug tool for AJAX requests, and I'd like to show the request/response headers (much like Firebug does). I can get the response headers using <a href="http://www.w3.org/TR/XMLHttpRequest/#the-getallresponseheaders-method" rel="noreferrer">jqXHR.getAllResponseHeaders</a>, but is there an equivalent for the <strong>request headers</strong>?</p>
  
  <hr>
  
  <p>If not, I know I can somewhat reconstruct it myself:</p>
  
  <pre><code>GET /blah  // this part is easy
  Host: servername.com  // pretty easy
  Accept:  ???
  Referer: ??? // just use current page url?
  User-Agent:  // easy from navigator.userAgent
  X-Requested-With: XMLHttpRequest   // hardcoded, $.ajax always does this?
  Accept-Charset: ???
  Accept-Encoding: ??? 
  Accept-Language: ???
  Connection: ???  
  </code></pre>
  
  <p>I care mostly about <code>Accept</code>. It seems the browser or something is changing this, since I am setting  <code>$.ajax({dataType:'json'})</code> and in firebug I see <code>Accept  application/json, text/javascript, */*; q=0.01</code>. I'd like to be able to capture the actual header being sent.</p>
  
  <p>For <code>Referer</code>, is it safe to just use window.url, or could it be something else? </p>
  
  <p>I have no idea how to get the <code>Accept-*</code> or <code>Connection</code> values.</p>