Answer the question
In order to leave comments, you need to log in
How to get header value in AJAX request?
Connecting to the server via https.
It gives me headers:
Content-Type: application/json; charset=utf-8
and
X-Powered-By: ASP.NET
Which the fidler confirms.
Ajax request via XMLHttpRequest
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", url, true);
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState === 4) {
if(this.status >= 200 && this.status < 400) {
var contentType = xmlhttp.getResponseHeader('Content-Type');
var poweredBy = xmlhttp.getResponseHeader('X-Powered-By');
}
}
};
xmlhttp.send(null);
Answer the question
In order to leave comments, you need to log in
Helped Access-Control-Expose-Headers
Ie . registered on the server
And everything worked
Should work. Try looking through xmlhttp.getAllResponseHeaders().
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question