咨询电话:
15628812133
19
2018/05

AJAX

发布时间:2018-05-19 22:42:27
发布者:xuzhongqiang
浏览量:
0

AJAX异步请求数据

       var xmlhttp;

           xmlhttp=window.XMLHttpRequest

              xmlhttp=new XMLHttpRequest();

              xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

 

xmlhttp.open("GET","/try/ajax/ajax_info.txt",true);

              xmlhttp.send();

 

       xmlhttp.onreadystatechange=function()

       if (xmlhttp.readyState==4 && xmlhttp.status==200) {

                     document.getElementById("myDiv").innerHTML=xmlhttp.responseText;

              }

      

 

 

优点:在不重新加载整个页面的情况下,可以与服务器交换数据并更新部分网页内容。

而且不需要任何浏览器插件


关键词:
返回列表