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 webstorm上开发的vue3+vite5+typeScript打包时报错
  • ¥15 vue使用gojs,需求在link中的虚线上添加方向箭头
  • ¥15 CSS通配符清除内外边距为什么可以覆盖默认样式?
  • ¥15 SPSS分类模型实训题步骤
  • ¥100 求ASMedia ASM1184e & ASM1187e 芯片datasheet/规格书
  • ¥15 求解决扩散模型代码问题
  • ¥15 工创大赛太阳能电动车项目零基础要学什么
  • ¥20 limma多组间分析最终p值只有一个
  • ¥15 nopCommerce开发问题
  • ¥15 torch.multiprocessing.spawn.ProcessExitedException: process 1 terminated with signal SIGKILL