zoukankan      html  css  js  c++  java
  • html请求_ashx.cs页码Example

      

    //1创建对象 XMLHttpRequest   

          var request = createXHR();

            function createXHR() {//判断浏览器兼容             var xhr;    

             if (XMLHttpRequest) {      

               xhr = new XMLHttpRequest();   

              } else {      

               xhr = new ActiveXObject("Microsoft.XMLHTTP");   

              }         

        return xhr;        

    }    

         function send() {

                document.getElementById("d").innerHTML = "加载中...";       

          //2初始化         

        request.open("get", "02_getTime.ashx?_=" + Math.random(), true);     

            //3注册事件       

          request.onreadystatechange = function () {

                    if (request.readyState == 4) {

                        if (request.status == 200) {    

                         var res = request.responseText;     

                        document.getElementById("d").innerHTML = res;    

                     } else {                

             document.getElementById("d").innerHTML = "服务器内部错误";       

                  }

                    }     

            }    

             //4.发送请求     

            request.send();       

      }

  • 相关阅读:
    frp穿透.md
    6_模板与渲染.md
    4_多数据格式返回请求结果.md
    3_请求参数绑定与多数据格式处理.md
    5_中间件.md
    1_go_gin介绍.md
    2_Gin网络请求与路由处理.md
    14_文件.md
    firefox油猴脚本编写.md
    js 四舍五入
  • 原文地址:https://www.cnblogs.com/nqsan/p/3373823.html
Copyright © 2011-2022 走看看