我使用ajax插入数据.注册后如果成功,它将重定向到其注册表页面或registry.php.但似乎它没有重定向到它各自的页面,奇怪的是当我在firefox上的控制台上检查它似乎它给出了正确的结果,像这样的POST xxxx/form_zuri/insertData.php 302发现50ms和获取xxxx/form_zuri/registry.php 302找到37ms.
下面是insertData.php的代码
if($data = $admin->insertRegistrantInfo($fname, $lname, $aname, $email, $password) == true) {
session_regenerate_id(true);// destroying the old session id and creating a new one
$_SESSION['id'] = $data;
header('location: registry.php');
exit();
Run Code Online (Sandbox Code Playgroud)
继承我的ajax脚本:
$("#submit_third").click(function(){
$.ajax({
type: "POST",
url: "insertData.php",
data: {
fname : $("#fname").val(),
lname : $("#lname").val(),
aname : $("#aname").val(),
email : $("#email").val(),
password : $("#password").val()
},
cache: false,
success: function(data) {
//window.location.replace('registry.php') ;
}
});
//window.location.replace('registry.php') ;
//return false;
});
Run Code Online (Sandbox Code Playgroud)
如果我将使用.replace js函数,它将无法获得SESSION ID.
任何想法的家伙?