1.http概念
2.http请求步骤
3.http请求的内容
3.1get和post
3.2 http响应


4.实例:
<!-- 封装请求函数 --> <script> function ajax({ method, //请求的方式"get"/"post" url, //请求地址 success //回调函数 }){ var xhr =new XMLHttpRequest(); xhr.open(method,url,true); xhr.send(); xhr.onreadystatechange = function(){ if(xhr.readyState ==4 && xhr.status ==200){ var res = JSON.parse(this.responseText); success(res); } } } </script><!-- 使用函数 --> <script> ajax({ method:"get", url:"http://192.168.4.18:8000/", success: function(res) { console.log(res) } }) </script>