在线测试跨域

kyaa111 14天前 ⋅ 114 阅读

找个网页F12后, 控制台输入如下代码, 能获取到响应即正常

var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://localhost:7099/api/xx/xx');
xhr.send(null);
// 
xhr.o n l o a d = function(e) {
    var xhr = e.target;
    console.log(xhr.responseText);
}