cache.html ------- 静态页面
$(function(){
$.post("server.php",{flag:1},function(ev){ if (ev.code==1) {
$('p').append(ev.msg)
}else{
$('p').append(ev.msg)
}
},'json')
})
static.php ---------PHP代码<?php
$file = "cache.html";
$expr = 60; if(file_exists($file)) {
$ctime =filectime($file); if($ctime+$expr > time()){ //判断是否过期
echo file_get_contents($file);
}else{
unlink($file);
ob_start(); include('static.html');
$content = ob_get_contents();
file_put_contents($file,$content);
ob_end_flush();
}
}?>
执行static.php时 调用静态页面可以执行ajax程序 为什么 我单独打开cache.html时ajax没有执行?
请问这是为什么呢