在线测试跨域
2024-04-16 15:32:53 525
找个网页F12后, 控制台输入如下代码, 能获取到响应即正常
var xhr = new XMLHttpRequest();
xhr.open('POST', '/xxx/xxx');
xhr.setRequestHeader('Content-Type', 'application/json;charset=utf-8');
xhr.send('{"type": 1');
xhr.onload = function(e) {
var xhr = e.target;
console.log(xhr.responseText);
}