title: Facebook Login: How to combine JavaScript with PHP SDK?
body: <p>How do I go about combining examples from both</p>
  
  <p><a href="https://github.com/facebook/php-sdk/blob/master/examples/example.php" rel="noreferrer">https://github.com/facebook/php-sdk/blob/master/examples/example.php</a> and
  <a href="https://github.com/facebook/connect-js/blob/master/examples/jquery/login.html" rel="noreferrer">https://github.com/facebook/connect-js/blob/master/examples/jquery/login.html</a></p>
  
  <p>The end goal is so that we can use jQuery to sign in, and somehow the following line would still work</p>
  
  <pre><code>$user = $facebook-&gt;getUser();
  </code></pre>
  
  <p>What I currently notice is that when I sign in with JavaScript, it doesn't set the session with PHP, hence, it is incompatible with PHP based SDK (so $user in this case would still be null)</p>
  
  <p>I am not a big fan of <code>&lt;a href="$facebook-&gt;getLoginUrl()"&gt;Login with Facebook&lt;/a&gt;</code>, 
  because it causes the browser to load a different page (the facebook login) and then redirects back to the web app. It is far more ideal if I can load up a popup box for user to signin, and then transparently redirects back to my web app. So any suggestions on how I can go about implementing this user experience would be greatly appreciated. Thank you!</p>