zoukankan      html  css  js  c++  java
  • Ajax实例

     1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
     2 "http://www.w3.org/TR/html4/strict.dtd">
     3 
     4 <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
     5     <head>
     6         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     7         <title>Ajax实例</title>
     8         <script type="text/javascript" src="script/jquery-1.12.2.js"></script>
     9         <meta name="author" content="Administrator" />
    10         <!-- Date: 2016-04-04 -->
    11     </head>
    12     <body>
    13         <input type="button" value="Ajax提交" onclick="Ajax();" />
    14         <div id="resText"></div>
    15         <script type="text/javascript">
    16             function Ajax() {
    17               var xmlHttpReg = null;
    18               if(window.ActiveXObject){
    19                   xmlHttpReg = new ActiveXObject("Microsoft.XMLHTTP");
    20               }else if(window.XMLHttpRequest){
    21                   xmlHttpReg = new XMLHttpRequest();
    22               }
    23               xmlHttpReg.open("GET","test.php",true);
    24               xmlHttpReg.onreadystatechange = RequsetCallBack;
    25               xmlHttpReg.send(null);
    26               function RequestCallBack() {
    27                 if(xmlHttpReg.readyStatus==4){
    28                     if(xmlHttpReq.status==200){
    29                         document.getElementById("resTest").innerHTML = xmlHttpReq.responseText;
    30                     }
    31                 }
    32               }
    33             }
    34         </script>
    35     </body>
    36 </html>
  • 相关阅读:
    第一章 初识shiro
    LDAP概念
    css定位
    css随笔1
    自己动手实现信息检索系统
    IntelliJ IDEA和pycharm注册码
    俄罗斯农夫算法
    [NOIP2013]转圈游戏
    [codevs1287]矩阵乘法
    [洛谷1314]无序字母对
  • 原文地址:https://www.cnblogs.com/Arther-J/p/5352026.html
Copyright © 2011-2022 走看看