1.創建XMLHttpRequest let xhr=new XMLHttpRequest; 2.連接伺服器 xhr.open("get","goods.json",true) true代表非同步,false代表同步。goods.json代表請求的路徑 3.向伺服器發送請求 xhr.send() 4. ...
1.創建XMLHttpRequest
let xhr=new XMLHttpRequest;
2.連接伺服器
xhr.open("get","goods.json",true)
true代表非同步,false代表同步。goods.json代表請求的路徑
3.向伺服器發送請求
xhr.send()
4.接受伺服器響應的數據
ajax的作用:向http伺服器發送請求,並可以接收到http伺服器響應的數據