Q: PHP Sessions lost on ajax call I am giving users the option to login via Facebook, all is fine except that I wish to move some other pre-set session variables through to the last page of the app. The sessions are declared on the Facebook login page. The Facebook Login button uses axjax/jquery to load a php page in the background. This php background page cannot grab the session variables from login page. This is where I am pretty much stuck on for days. Can anyone please assist?
Code below is runs when login button is clicked in a frame on the login page where Session variables are set. I expected that having session_start() would work but it does not. I echoed the vars they did not print.
    //Facebook Login page   
   if(isset($_GET["logout"]) && $_GET["logout"]==1)
     {
//User clicked logout button, distroying all session variables.
session_destroy();
header('Location: '.$return_url);
     }
     ?>


     <?php

      session_start();

     if(!isset($_SESSION['logged_in']))
       {
          echo '<div id="results">';
           echo '</div>';

           echo '<a href=" " rel="nofollow" class="fblogin-button" onClick="javascript:CallAfterLogin();return false;">  </a>';

     }
      else
      {
echo 'Hi '. $_SESSION['user_name'].'! You are Logged in via facebook, <a href="?    logout=1">Log Out</a>.';
     }
    ?>

     <div id="fb-root"></div>
     <script type="text/javascript">
     window.fbAsyncInit = function() {
  FB.init({
    appId: '<?php echo $appId; ?>',
    cookie: true,xfbml: true,
    channelUrl: '<?php echo $return_url; ?  >/concrete/blocks/external_form/forms/channel.php',
    oauth: true
    });
};
(function() {
var e = document.createElement('script');
e.async = true;e.src = document.location.protocol +'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);}());

 function CallAfterLogin(){
FB.login(function(response) {       
    if (response.status === "connected") 
    {
        LodingAnimate(); //Animate login
        FB.api('/me', function(data) {

          if(data.email == null)
          {

                alert("login requires to access your email address!"); 
                ResetAnimate();

          }else{
                AjaxResponse();
          }

      });
     }
},
{scope:'<?php echo $fbPermissions; ?>'});
 }

 //functions
   function AjaxResponse()
 {
 //Load data from the server and place the returned HTML into the matched element    using jQuery Load().
 $( "#results" ).load( "process_facebook.php"  );

  }


A: Being that you didn't share any code, I'm not completely sure what the problem is.
However, from what you're saying, I think you should try adding this to the top of the php background page:
session_start();

