1.创建XMLHttpRequest

let xhr=new XMLHttpRequest;

2.连接服务器

xhr.open(“get”,”goods.json”,true)

true代表异步,false代表同步。goods.json代表请求的路径

3.向服务器发送请求

xhr.send()

4.接受服务器响应的数据

ajax的作用:向http服务器发送请求,并可以接收到http服务器响应的数据

版权声明:本文为luoluo-snow原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/luoluo-snow/p/11510951.html