first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ajax</title>
</head>
<body>
<ul>
</ul>
</body>
<!-- <script>
function getData(res) {
console.log(res);
}
</script>
<script src="http://127.0.0.1/?v=getData"></script> -->
<script>
// 创建一个新的ajax对象拿出电话
var xhr = new XMLHttpRequest();
// methos 四种 请求方式
// POST 给的动作,新增
// GET 要的动作
// PUT 给的动作,更新
// DELETE 给的动作,删除
// 设置请请求方式和地址
xhr.open("POST", "http://127.0.0.1/my.php")
// 发送请求,开始拨号
// xhr.setRequestHeader("Content-Type","application/json; charset = UTF-8");
// var res = new FormData();
// res.append("id", 1)
// res.append("name", 2)
// var dara = JSON.stringify({ id: 1, name: 2 });
xhr.send()
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
var data = JSON.parse(xhr.responseText)
console.log(data);
// data.result.model.res.forEach(v => {
// document.querySelector("ul").innerHTML += `
// <li>
// <p>${v.title}</p>
// <img src="${v.preview}" alt="">
// </li>
// `
// });
} else {
console.log("暂无数据");
}
}
}
</script>
</html>