I am making an AJAX request via jQuery's $.ajax() method.
I have specified a success callback using :
$.ajax({
...
success: function(data, textStatus, xhr) {
...
}
});
Is it possible to see in the callback what request headers were sent ? For example, to retrieve a specific request header value ?
EDIT: 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.
e.g.
in their code is :
$.ajax({
beforeSend: function(xhr) {
xhr.setRequestHeader('A','B');
},
success: rogersCallbackMethod
});
Then in my code I would like to say something like this :
function rogersCallbackMethod(data, textStatus, xhr) {
if (xhr.getRequestHeader('A') == 'B') {
...
}
}