zoukankan      html  css  js  c++  java
  • ajax提交的javascript代码

    var xhr=xhr();

    function xhr(){

          if(window.XMLHttpRequest){

                     return   window.XMLHttpRequest();

                    }else if(window.ActiveXObject){

                          return new ActiveXObject("Microsoft.XMLHTTP");

                    }catch(e){

                         try{

                                 return new ActiveXObject("Msxml2.XMLHTTP");

                            }catch (ex){}

                       }

                     }

                 }

                xhr.open("get","url","true");

               xhr.onreadystatechange=function(){

                      if(xhr.readyState==4&&(xhr.status==200||xhr.status==304)){

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

                               }

                        }

                    xhr.send();

           

  • 相关阅读:
    适配器模式(Adapter)
    状态模式(State)
    观察者模式(Publish/Subscribe)
    建造者模式(Builder)
    数据库,知识点汇总
    数据库
    css样式大全
    遮罩层
    js数组冒泡
    js基本方法
  • 原文地址:https://www.cnblogs.com/suajiu9/p/6376133.html
Copyright © 2011-2022 走看看