Reputation: 800
i am trying to send header from a php file that is called with ajax. problem is, when i validate all information with php, i want to redirect to another page but headers dont work! any ideas?
what the code does:
//------------- index.php
on click of input, function passes <input> values through $_POST to login.php
if($_SESSION[superman]==true){redirects to index_main.php}
//------------- login.php
all it does is validate forms and if login and password are correct, it sets $_SESSION [superman]=true
Upvotes: 3
Views: 1324
Reputation: 91983
The redirect will only redirect the Ajax call! If you want to change the displayed page in the browser, you'll need to redirect using Javascript once the Ajax call completes.
true
or maybe the URL to the page you want to load)location.href
using Javascript.Upvotes: 5