Is it possible to use the php header () command to call ajax to redirect?

I am wondering if I can use the header ("Location: someFile.php"); from a script that is called via AJAX. When I call this script, the answer is the page I'm trying to redirect to.

If not, what are some of the options for handling user redirection through an ajax call?

I tried window.location (), but it does not capture browser history (cannot use the back button).

+3
source share
1 answer

No, if you select the title ("Location: ...") - you will redirect the AJAX call itself, but not the user's browser window. The only way -window.location.href="http://my.new.location/xxx/yyyy"

" " AJAX.

Hovewer, window.location.href javascript ( AJAX), "", . AJAX.

+5

Source: https://habr.com/ru/post/1749292/


All Articles