<script>
let bt = document.querySelector("input");
let mydiv = document.querySelector("div");
let xhr = "null";
// fetch为全局对象的方法,非js库
bt.onclick = function () {
fetch("http://localhost:8000/", {
method: "post",
headers: {
name: "lilee"
},
body: "password=999&name=wang"
}).then(function (r) {
return r.text();
}).then((r) => {
console.log(r);
})
}
</script>