码迷,mamicode.com
首页 > Web开发 > 详细

【JS】长轮询

时间:2019-03-23 13:24:54      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:func   cti   OLE   span   ext   服务器   amp   style   ===   

循环请求服务器数据

    function send () {
      xhr.open(‘GET‘, ‘/clock‘, true);
      xhr.onreadystatechange = function () {
        if (xhr.readyState === 4 && xhr.status === 200) {
          console.log(xhr.responseText);
          send()
        }
      }
      xhr.send()
    }
    send()

 

【JS】长轮询

标签:func   cti   OLE   span   ext   服务器   amp   style   ===   

原文地址:https://www.cnblogs.com/wuxianqiang/p/10583302.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!