发送HTTP请求是否可以获取请求头?
await $.ajax({
"url":"http://localhost:8101/jiaqianjiami",
"method":"POST",
"content-type":"appication/json",
"data":JSON.stringify({
"idType": "1"
}),
timeout:"10000",
"success":function(response){;
response = typeof response == "object" ? response : JSON.parse(response)
}
});
尝试ajax也是获取不到?是否有其他途径获得
请求需要依赖这个接口返回的响应头参数
把response改成r或者其他字母
await $.ajax({
url:"https://echo.apipost.cn/get.php",
method:"POST",
headers:{
"content-type":"application/json"
},
timeout:"10000",
data:JSON.stringify({"email":"xxx@xxx.com","password":"123456"}),
success:function (r, status, xhr, header) {
console.log(r, status, xhr, header);
apt.globals.set("bigint",r.bigint);
},
error:function (e1, e2, e3){
console.log(e1, e2, e3);
}
}
);