PHP- Ajax and Redirect

前端 未结 3 610
情书的邮戳
情书的邮戳 2020-12-11 12:33

i have a jquery Ajax request happening on a page. On php side i am checking if the session is active and doing something. If the session is not active i want to redirect th

3条回答
  •  囚心锁ツ
    2020-12-11 12:47

    Redirects only say "The data you requested can be found here".

    HTTP provides no way to say "Even though you requested a resource to go inside a page, you should should leave that page and go somewhere else".

    You need to return a response that your JavaScript understands to mean "Go to a different location" and process it in your own code.

提交回复
热议问题