I am using ajax. Here. i can get response header.
var getUrl = $.ajax({
type: urlType,
url: url,
data:data,
beforeSend:function(xhr){console.log(xhr)},
success: function(data) {
$('.response').show();
$('#resData').val(data);
$('#resHeader').val(getUrl.getAllResponseHeaders());
// console.log(getUrl.header)
},
error: function(jqXHR, textStatus, errorThrown) {
},
complete: function (XMLHttpRequest, textStatus) {
console.log(XMLHttpRequest)
}
});
In this, I didn't set headers. by Default, It pass the request header which is shown in network tab.
I have to get request header in beforeSend, success & complete.
How can i get req header from ajax
This req header i can get in network tab
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip,deflate,lzma,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Host:localhost
If-Modified-Since:Fri, 14 Nov 2014 03:54:43 GMT
If-None-Match:"f60-507c996d5d401"