I have this login form which uses AJAX to query a database for checking if the user exist, if the password is correct, etc. Now, how can I re开发者_运维问答direct the user when all the checking is done? I have tried to just do like this:
//PHP code...
//A lot of different checks happens before this
if($_POST['password']==$db_password){ //Last check!
header("Location: member-page.php");
}
But that doesn't work (it doesn't return any errors either):( So, how can I do this? Thanks for the help!
If you're doing it via AJAX you'll have to do it on the page that is making the AJAX request, so you'll need to do it client-side... in jQuery it might look a bit like this...
$.post("test.php", { name: "John", time: "2pm" },
function(data) {
if (jQuery.trim(data) == 'success') {
window.location = '/member-page.php';
}
});
精彩评论