标签:过程 大写 new 同步 html 微软雅黑 结果 对象 实时
一、Ajax概念:局部网页实时异步刷新技术;
二、异步/同步:
同步:填完所有信息后,全部提交服务器,服务器响应后一次性返回全部;
异步:填完一条信息后,就提交服务器,服务器响应过程,依旧可以操作;
三、使用五部曲:
1.创建一个异步对象:
var htmlhttp=new XMLHttpRequeset();
2.设置请求方式和请求地址:
htmlhttp.open("POST","url",true); //post/get需要大写
3.发送请求:
htmlhttp.send();
4.监听状态的变化:
htmlhttp.onreadystatechange=function () {};
htmlhttp.readyState==4; //取值0,1,2,3,4;只有4表示发送成功;
5.处理返回的结果:
htmlhttp.status>=200 || htmlhttp.status<300 || htmlhttp.status===304;
//200表示成功;
标签:过程 大写 new 同步 html 微软雅黑 结果 对象 实时
原文地址:https://www.cnblogs.com/Tractors/p/11079345.html