Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
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
Posted
Comments
Mohibur Rashid 7-May-15 18:49pm    
Call session_start on every page
sadorect 8-May-15 4:17am    
Rashid,

Thanks for your input. I know session_start() is the way to preserve session status but, in this case, the variable set in the ajaxLogin page did not pass to the nextPage. All the three pages (calling, called and forward) have session_start() declared.

Thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900