我正在使用$.post()Ajax调用servlet,然后使用生成的HTML片段替换div用户当前页面中的元素.但是,如果会话超时,服务器会发送重定向指令以将用户发送到登录页面.在这种情况下,jQuery正在用div登录页面的内容替换元素,迫使用户的目光确实见证了罕见的场景.
如何使用jQuery 1.2.6从Ajax调用管理重定向指令?
我试图从使用ajax调用的php文件发送标头.问题是,当我用PHP验证所有信息时,我想重定向到另一个页面,但标题不起作用!有任何想法吗?
代码的作用:
//------------- index.php
on click of input, function passes <input> values through $_POST to login.php
if($_SESSION[superman]==true){redirects to index_main.php}
//------------- login.php
all it does is validate forms and if login and password are correct, it sets $_SESSION [superman]=true
Run Code Online (Sandbox Code Playgroud)