1.创建ajax对象

var xhr=new XMLHttpRequest();

4.监听状态信息

xhr.onreadystatechange=function(){
   //4接收完毕
   if(xhr.readyState==4){
         document.getElementById('div').innerHTML=xhr.responseText;
    }           
}

 

2.设置请求方式及URL地址

xhr.open('get','/1.php');

3.发送请求

//get null   post请求的数据
xhr.send(null);

 

相关文章:

  • 2021-04-27
  • 2022-01-09
  • 2021-05-17
  • 2021-06-23
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-08
  • 2021-11-20
  • 2022-01-29
  • 2021-11-08
  • 2021-10-27
  • 2021-06-05
相关资源
相似解决方案