Files
ClassContent/历届学生/逯帅帅/每日课程/2021-03-09/index.html
2024-09-27 02:06:13 +08:00

35 lines
756 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
<!--<script>-->
<!-- function getData(res) {-->
<!-- console.log(res)-->
<!-- }-->
<!--</script>-->
<!--<script src="http://127.0.0.1:3000?a=getData"></script>-->
<script>
// 1拿出手机 初始化一个新的ajax对象
var ajax = new XMLHttpRequest();
// 2设置号码
ajax.open("GET","http://127.0.0.1:3001");
// 3拨号
ajax.send();
// 4拨号监听
ajax.onreadystatechange = function () {
if (ajax.readyState == 4 ) {
if (ajax.status == 200) {
console.log(JSON.parse(ajax.response))
} else {
console.log("网络请求出错")
}
}
}
</script>
</html>