//创建异步对象
var xhr = new XMLHttpRequest();
xhr.open('post', 'test2.php' );
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xhr.send(`username=${username}&password=${password}`);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
console.log(xhr.responseText);
}
};
js异步请求
最新推荐文章于 2024-03-28 21:33:28 发布