php:
<?php header(‘sessionStatus:timeOut‘); //is_ajax echo $_SERVER[‘HTTP_X_REQUESTED_WITH‘];
html:<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <script type="text/javascript" src="js_class/html5/jquery-1.7.2.js"></script> <script type="text/javascript"> $(function(){ $.ajax({ url:‘file_exits.php‘, type:"get", success:function(res){ alert(res); }, complete:function(XMLHttpRequest, str){ if(XMLHttpRequest.getResponseHeader("sessionStatus") == "timeOut"){ alert(‘超时了‘); } }, }); }); </script> </head> <body> </body> </html>
PHP jquery session超时处理
时间: 2024-10-27 05:12:51