如何从Ajax调用传递php会话变量 [英] How Do I pass php Session Variable From Ajax Call
问题描述
我有一个login.php页面,用于通过Ajax调用验证用户登录。当ajax验证成功时,它会设置会话。当我从登录页面导航时,我想将会话变量传递到下一页。
请参阅下面的jquery代码:
$ .ajax({
类型:POST,
url:ajaxLogin.php,
数据:dataString,
cache:false,
beforeSend:function(){$(#login)。val('Connecting ...');},
success:function(data){
if(data)
{
$(body)。load(nextPage.php).hide()。fadeIn(1500).delay(6000);
nextPage.php应该包含从ajaxLogin.php成功验证的会话集,但它没有。
请帮忙。
谢谢
.ajax({
type:POST,
url:ajaxLogin.php ,
data:dataString,
cache:false,
beforeSend:function(){
I have a login.php page that validates user login with a Ajax call. When the ajax validation is successful, it sets a session. I want to pass the session variable on to next page as I navigate from the login page. 这篇关于如何从Ajax调用传递php会话变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
success:function(data){
if(data)
{
(body)。load(nextPage.php).hide()。fadeIn(1500).delay(6000);
nextPage.php应该包含从ajaxLogin.php成功验证的会话集,但它没有。
请帮忙。
谢谢
See jquery code below:
$.ajax({
type: "POST",
url: "ajaxLogin.php",
data: dataString,
cache: false,
beforeSend: function(){ $("#login").val('Connecting...');},
success: function(data){
if(data)
{
$("body").load(nextPage.php).hide().fadeIn(1500).delay(6000);
The "nextPage.php" should contain the session set on successful validation from the ajaxLogin.php but, it does not.
Please help.
Thanks.ajax({
type: "POST",
url: "ajaxLogin.php",
data: dataString,
cache: false,
beforeSend: function(){
("#login").val('Connecting...');},
success: function(data){
if(data)
{
("body").load(nextPage.php).hide().fadeIn(1500).delay(6000);
The "nextPage.php" should contain the session set on successful validation from the ajaxLogin.php but, it does not.
Please help.
Thanks