I have an AJAX function that carry the content of a page (list.php) within a "div" the page (home.php), page (list.php) has a function that checks if the session has expired, if yes, you should go to index.php. It turns out that when I use header ('Location: index.php'); redirection is being done only within the "div" and I wish instead be redirected entire page I am (home.php). This is causing me to stay in home.php and is being shown within "div" the "index.php", and would have is showing only the "index.php"
1条回答 默认 最新
- weixin_33724570 2014-07-28 19:43关注
Place the redirect in the callback of your AJAX function. You will want to use something like
window.location = ""
in Javascript after there is a response in your AJAX object.If you are using plain JS, you will want to watch for your
onreadystatechange
event to equal4
, then do the redirect accordingly depending on the response code and what your intended functionality is.解决 无用评论 打赏 举报