javascript - How to get the content of ajax request header using js?
天蓬老师
天蓬老师 2017-05-19 10:08:25
0
2
597
  1. How to get ajax request header information in js

2. When I use XMLHttpRequest.header in the complete method of ajax, the value obtained is undefined. Is it undefined without this parameter?

3. If my above idea is wrong, please give me some advice

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(2)
滿天的星座

Maybe this:
var xhr = new XMLHttpRequest();
xhr.open('get','',false);
var headers = xhr.getAllResponseHeaders();
xfr.send();

PHPzhong

var request = new XMLHttpRequest();
request.open("GET", "foo.txt", true);
request.send();
request.onreadystatechange = function() {
if(this.readyState == this.HEADERS_RECEIVED) {

console.log(request.getAllResponseHeaders());

}
}

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template