zoukankan      html  css  js  c++  java
  • AJAX调用实例

    var XmlHttp=new ActiveXObject("Microsoft.XMLhttp");
    function sendAJAX()
    {
    XmlHttp.Open("POST","admin/UserCount.aspx",true);
    XmlHttp.Send(null);
    XmlHttp.onreadystatechange=ServerProcess;
    }
     function ServerProcess()
    {
    if(XmlHttp.readystate==4 || XmlHttp.readystate=='complete')
    { //document.getElementById('hidelogin').value=XmlHttp.responsetext;
    var lineuser=XmlHttp.responsetext;
    var retstr=lineuser.split('<');
     var num=retstr[0].replace(/(^\s*)|(\s*$)/g,"");//因返回的是html,故先得到所要数据,然后入到td中,不然会变形
     document.getElementById('OnlineUser').innerText="在线人数:"+num;
     }
     }
    setInterval('sendAJAX()',500000);//5分钟一下在线总数
  • 相关阅读:
    python解析网页
    node.js 爬虫
    c++ split实现
    foldl foldr
    爬虫http header gzip
    命令[10]
    命令[08]
    命令[15]
    命令[13]
    命令[11]
  • 原文地址:https://www.cnblogs.com/hhq80/p/979561.html
Copyright © 2011-2022 走看看