亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么單獨點擊靜態頁面,不執行AJAX程序?

為什么單獨點擊靜態頁面,不執行AJAX程序?

aluckdog 2018-10-17 13:10:41
cache.html ------- 靜態頁面<html>     <script type="text/javascript">     $(function(){          $.post("server.php",{flag:1},function(ev){           if (ev.code==1) {                $('p').append(ev.msg)            }else{                $('p').append(ev.msg)            }       },'json')     }) </script><body>           <p></p>  </body>  </html>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沒有執行?請問這是為什么呢
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 813 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號