zoukankan      html  css  js  c++  java
  • Ajax获取服务器信息

     1 xhr.onreadystatechange = function(){
     2             if (xhr.readyState == 4){
     3                 if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304){
     4                     alert(xhr.responseText);
     5                     var headers =  xhr.getAllResponseHeaders();
     6             //获取所有响应头信息
     7              alert(headers);
     8             //获取指定的响应头里面的信息
     9             //获取时间
    10             //alert(xhr.getResponseHeader("Date"));
    11             //获取服务器
    12             //alert(xhr.getResponseHeader("Server"));
    13             //获取服务器脚本版本
    14             //alert(xhr.getResponseHeader("X-Powered-By"));
    15             //获取相应头长度
    16             //alert(xhr.getResponseHeader("Content-Length"));
    17             //获取链接状态
    18             //alert(xhr.getResponseHeader("Connection"));
    19             //获取文档类型
    20             //alert(xhr.getResponseHeader("Content-Type"));
    21             //获取连接持续时间
    22             //alert(xhr.getResponseHeader("Keep-Alive"));
    23                     document.myform.time.value = xmlHttp.responseText;
    24                 } else {
    25                     alert("Request was unsuccessful: " + xhr.status);
    26                 }
    27             }
    28         };
    一直在追赶,从未敢怠慢!
  • 相关阅读:
    poj3372 Candy Distribution
    poj3270 Cow Sorting
    poj2888 Magic Bracelet
    poj2429 GCD & LCM Inverse
    poj1811 Prime Test
    poj2689 Prime Distance
    【思维】2017多校训练七 HDU6121 Build a tree
    【字符串+BFS】Problem 7. James Bond
    【dfs】codeforces Journey
    【思维+贪心】codeforces Game of the Rows
  • 原文地址:https://www.cnblogs.com/scottjeremy/p/5805053.html
Copyright © 2011-2022 走看看