Ajax的学习

1.ajax asynchronous javascript and xml (异步的javascript和xml)

2.请求代码的流程

   var xmlHttp = new XMLHttpRequest();

   if(xmlHttp!=null){

          xmlHttp.onreadystatechanage = function(){

              if(xmlHttp.readyState == 4 && xmlHttp.status == 200)  //4请求成功  200成功返回数据

            var resultObj = eval("("+xmlHttp.responseText+")");//JSON化返回数据

    }

           xmlHttp.open("GET","http://****",true);//设置请求类型,路径及方式

           xmlHttp.send();//发送请求

  }

posted @ 2013-07-10 00:10  笨兔儿  阅读(115)  评论(0编辑  收藏  举报