<!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>
</body>
<script>
var xhr = new XMLHttpRequest();
xhr.open("get","http://1.116.155.64:5000/get123",true);
xhr.onreadystatechange = (res)=>{
if(xhr.readyState === 4 && xhr.status == 200){
var res =JSON.parse(xhr.responseText);
console.log(res)
}
}
xhr.send();
</script>
</html>```
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210507110712894.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2J6bmhsaGg=,size_16,color_FFFFFF,t_70#pic_center)
原生Ajax
最新推荐文章于 2024-07-16 11:07:42 发布