I use php with ajax.
<?php
/*
* Suppose, user has entered both correct login and password
* then server response is TO **REDIRECT** to profile page
*
/
header('location:/');
/*
*
* print <<<HTML
<scrpit> window . location = '/profile.php';</script>
HTML;
* also doesnt work
**/
?>
The problem is that it does redirect, but leaves part of authorization page, and the result = is mixed profile + auth page
When using AJAX, redirecting using
header()will not work.This is what will happen:
What you need to do is:
$_SERVER['HTTP_X_REQUESTED_WITH']has the value ofxmlhttprequest. Most JS libraries will send this.header('Location: /')echo('location.replace("\")');