javascript - 原生 get 请求库
function get() {
const http = new XMLHttpRequest();
const url = '1.php';
http.open('GET', url);
http.onreadystatechange = function () {//Call a function when the state changes.
if (http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}
}
http.send();
}