posts - 11,comments - 17,trackbacks - 0
          如何使用一個(gè)XMLHttpRequest對(duì)象
          In?Mozilla,?Firefox,?Safari,?and?Netscape,?you?create?an?instance?of?the?XMLHttpRequest?object
          by?doing?the?following:
          <script>var?xhr?=?new?XMLHttpRequest();</script>
          For?Internet?Explorer:
          <script>?var?xhr?=?new?ActiveXObject("Microsoft.XMLHTTP");</script>
          Here?is?an?example?of?using?the?XMLHttpRequest?object:
          <script>
          var?xhr?=?null;
          if?(window.XMLHttpRequest){
          xhr?
          =?new?XMLHttpRequest();
          }?
          else?{
          xhr?
          =?new?ActiveXObject("Microsoft.XMLHTTP");
          }
          if?(xhr)?{
          var?url?=?"/someURI";
          xhr.onreadystatechange?
          =?xhrCallback;
          xhr.open(
          "get",?url,?true)
          xhr.send()
          }
          function?xhrCallback()?{
          if?(xhr.readyState?==?4)?{
          if?(xhr.status?==?200)?{
          alert(
          "Ok");
          }?
          else?{
          alert(
          "Problem?retrieving?Ajax?response");
          }
          }
          }
          </script>

          posted on 2007-03-02 11:23 Ken.Lee 閱讀(171) 評(píng)論(0)  編輯  收藏 所屬分類: Ajax

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 潢川县| 梅河口市| 阳春市| 土默特左旗| 仁化县| 长宁区| 西平县| 邹城市| 富宁县| 东莞市| 樟树市| 长海县| 图片| 东明县| 麻城市| 深泽县| 蒲江县| 平遥县| 类乌齐县| 确山县| 临夏县| 庐江县| 花莲市| 卓资县| 利津县| 民乐县| 太仆寺旗| 登封市| 长垣县| 唐河县| 垫江县| 靖西县| 遂溪县| 柳江县| 新密市| 天门市| 沁水县| 绥德县| 定陶县| 虹口区| 秀山|