AJAX

2017-04-29  本文已影响0人  中石化局长

步骤一:创建XMLHttpRequest对象
              variable=new XMLHttpRequest();
              variable=new ActiveXObject("Microsoft.XMLHTTP")        (IE5、IE6)

步骤二:向服务器发出请求
              GET:xmlhttp.open("GET/POST","url:请求的文件在服务器上的位置",true/false);
                        xmlhttp.send();
        POST: xmlhttp.open("POST","/try/ajax/demo_post2.php",true);
                      xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
                      xmlhttp.send("fname=Henry&lname=Ford");

步骤三:服务器响应返回值
               可以返回responseText或者responseXML


状态信息:

回调函数:
      

AJAX的应用——输入框猜值

上一篇 下一篇

猜你喜欢

热点阅读