title: How to run a php script from javascript
body: <p>I am using FaceBook's Javascript and PHP SDK's together in a web-based application.</p>
  
  <p>I need to run a PHP script when a certain condition is met in my Javascript code.</p>
  
  <p>There is code in the PHP to check if the user is logged in on the application. if the user is not logged in, I use Facebook's javascript helper to grab their session data from the javascript sdk and add it to the database then sign them in on the application.</p>
  
  <p>this worked great until I did some testing and found out when i manually sign out of FB and the application then refresh the application, the Javascript helper is returning Null; causing an error 100 (which is a access token error i assume).</p>
  
  <p>which i am assuming i can avoid this error by only calling the PHP code during a certian condition on the javascript code (when user is connected to the application via JS SDK). Facebook says you can access your PHP sdk from your javascript sdk with an AJAX call. They do not provide any further information and I am very new to this.</p>
  
  <p>I have tried JQuery AJAX $.Get method and it seems to work but it doesn't run my PHP code??
  So i kept researching and found .Load. But it seems like i need to attach it to a DIV? is there another way to do this? I just need to run the code, nothing more.</p>
  
  <p>I am not sending data to the PHP code or returning data from PHP with the AJAX, the PHP just needs to be executed.</p>
  
  <pre><code>  function statusChangeCallback(response) {
  console.log('statusChangeCallback');
  console.log(response);
  
  // for FB.getLoginStatus()
  if (response.status === 'connected') {
  
    // Fire the PHP code 
  
  } else if (response.status === 'not_authorized') {
  
    console.log('Please log into facebook...')
  } else {
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Is it possible to Run my php file from javascript, then return to the javascript code?</p>
  
  <p>Should I be looking at an alternative solution?</p>