1.prepare front-end code, meta content-type cannot be ignored! as to the xhr, status should be 3

<!doctype html>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body> <div id="d"></div> <script type="text/javascript" src="/dwztp/Public/dwz/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
var xhr=new XMLHttpRequest(),pos=0;
xhr.onreadystatechange=function(){
if(xhr.readyState==3){
$("#d").html(xhr.responseText.substr(pos));
pos= xhr.responseText.length;
}
else{
$("#d").html(xhr.responseText);
}
};
$.ajaxSetup({cache:false});
xhr.open("get","a.php",true);
xhr.send(null);
// $.get("a.php",function(data){
// //document.write(data);
// });
</script>
</body> </html>

2.back-end, remember to to call two methods to set time limit to unlimited and cache-control to be no-cache;

<?
set_time_limit(0);
header("Cache-Control: no-cache, must-revalidate");
echo(date('Y'));
$no=0;
while (date('Y') == '2016'){
echo 'hello 2016+'.$no.'<br/>';
ob_flush();
flush();
sleep(2);
$no++;
}
?>

最新文章

  1. Java反射遍历数组
  2. MySQL wamp密码修改
  3. ZendStudio13 PHP调试环境快速配置
  4. C#手工注入辅助工具
  5. 【翻译十三】java-并发之饥饿与活锁
  6. SSH服务器拒绝密码检测
  7. VBA_Excel_教程:表,格
  8. ios数据库
  9. linux(centos 6)下记录所有用户的操作以及ip、时间
  10. [LeetCode] Longest Harmonious Subsequence 最长和谐子序列
  11. 抽奖大转盘 js代码
  12. 1_translation_1
  13. [ 高危 ] my网任意账户登陆
  14. 转:在 C# 中使用 P/Invoke 调用 Mupdf 函数库显示 PDF 文档
  15. Spring boot+mybatis+thymeleaf 实现登录注册,增删改查
  16. 命令实现linux和客户端文件上传下载
  17. java注解XML
  18. tile38 一款开源的geo 数据库
  19. [Maven]Maven中的一些基本概念
  20. 2018.09.30 bzoj4025: 二分图(线段树分治+并查集)

热门文章

  1. EWS code return Error : Request failed. The remote server returned an error: (403) Forbidden OR (401) Unauthorized
  2. Codevs1033 蚯蚓的游戏
  3. 【Python学习之五】高级特性1(切片、迭代、列表生成器、生成器、迭代器)
  4. Unity基础-发布
  5. W3CPLUS DEMO一些有意思的效果备份
  6. GoF23种设计模式之结构型模式之代理模式
  7. 思维水题:UVa512-Spreadsheet Tracking
  8. ACM Changchun 2015 J. Chip Factory
  9. hql的笔记
  10. meteor 检测运行环境,手机或者桌面