php header redirect not working
I'm not getting any error codes. Here's the php:
<?php
ini_set('display_errors', false);
if (!isset($_SESSION)) {
if($_POST['email']){
...several calls to external db...
if(strlen($response->supporter->item->Email))
//user is a member
header('Location: http://www.example.com/page-one/');
else
header('Location: http://another-site.com/');
}
}
?>
Nearly exactly the same code works in another part of the site. Any ideas why this is pulling the correc开发者_C百科t content, but not loading it on the page?
the ajax call is:
$.post("http://www.our_site.org/is_member.php", { email: email });
Try That:
<?php
ini_set('display_errors', false);
if (!isset($_SESSION)) {
if($_POST['email']){
...several calls to external db...
if(strlen($response->supporter->item->Email))
//user is a member
echo ('Location: http://www.example.com/page-one/');
else
echo ('Location: http://another-site.com/');
}
}
?>
And inside of your js do that:
$.ajax({
type: 'POST',
url: "http://www.our_site.org/is_member.php",
data: {email: email },
success: function(output){ window.location = output; }
dataType: dataType
});
精彩评论