请教个代码问题,大佬们

100次阅读

共计 365 个字符,预计需要花费 1 分钟才能阅读完成。

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
// 通信成功时,状态值为 4
if (xhr.readyState === 4){
if (xhr.status === 200){
console.log(xhr.responseText);
} else {
console.error(xhr.statusText);
}
}
};
xhr.onerror = function (e) {
console.error(xhr.statusText);
};
xhr.open(‘GET’, ‘https://xxxx/xxx’, true);
xhr.send(null);
目的是请求 https://xxxx/xxx 获取跳转链接然后刷新当前页面,该怎么写

正文完
 0