const http = new XMLHttpRequest();
const url = 'http://192.168.1.10/';
http.open('get', url, false);
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
http.onload = function () {
if(http.status === 200 || http.status == 0) {
alert("succeed")
} else {
alert("failed")
}
}
http.send();
为什么虽然它没有得到 http.status === 200 它没有警报失败!
相关分类