weixin_33743880 2014-07-28 19:41 采纳率: 0%
浏览 48

如何在PHP中重定向页面

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 equal 4, then do the redirect accordingly depending on the response code and what your intended functionality is.

    评论

报告相同问题?

悬赏问题

  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程