title: jQuery AJAX success callback : Can I see the headers sent?
body: <p>I am making an AJAX request via jQuery's $.ajax() method.</p>
  
  <p>I have specified a success callback using :</p>
  
  <pre><code>$.ajax({
      ...
      success: function(data, textStatus, xhr) {
          ...
      }
  });
  </code></pre>
  
  <p>Is it possible to see in the callback what request headers were sent ? For example, to retrieve a specific <strong>request</strong> header value ?</p>
  
  <p><strong>EDIT:</strong> The requirement is that I do not "own" the code calling the AJAX request, only the callback. I need to check in the callback whether a specific header was passed.</p>
  
  <p>e.g.</p>
  
  <p>in their code is :</p>
  
  <pre><code>$.ajax({
      beforeSend: function(xhr) {
              xhr.setRequestHeader('A','B');
      },
      success: rogersCallbackMethod
  });
  </code></pre>
  
  <p>Then in my code I would like to say something like this :</p>
  
  <pre><code>function rogersCallbackMethod(data, textStatus, xhr) {
      if (xhr.getRequestHeader('A') == 'B') {
             ...
      }
  }
  </code></pre>