title: cant access details other than "name" from FB.api in ajax function
body: <p>i have a problem with accessing user details like first_name, last_name, id and email, but i can access name directly. i can access user name by this code: </p>
  
  <pre><code>function testAPI()
  {      
    console.log('Welcome!  Fetching your information.... ');
  
    FB.api(
      '/me',
      'GET',
      {"fields":"id,name,first_name,last_name,email"},
      function(response)
      {
        f_id = response.id;
        name = response.name;
        fname = response.first_name;
        lname = response.last_name;
        email = response.email;
  
        console.log('Successful login for: ' + name + "\n first name: " + fname + "\n last name: " + lname + "\n email: " + email  + "\n ID: " + f_id);
        document.getElementById('status').innerHTML = 'Thanks for logging in, ' + response.name + '!';
      }
    );
    $.ajax(
      {
        type:"POST",
        url: 'http://localhost:8080/timeline_dashboard/index.php',
  
        // data: {f_id: f_id, name: name, fname: fname, lname: lname, email: email},
        data: {name:name},
        success: function(data)
        {
        alert(data);
        }
      }
    );
  }
  
  $(document).ready(
    function()
    {
      var f_id, name, fname, lname, email;
    }
  );
  
  &lt;?php //working code on index.php
  // print_r($_POST);die;
    if(isset($_POST['name']))
    {
      echo $_POST['name'];die;
    }
  ?&gt;
  </code></pre>
  
  <p>in this above code i sent the value of 'name' through ajax call and able to get that value through 'POST' method to index.php and when i change <code>data: {name:name},</code> to <code>data: {email:email},</code> or anything like id, first_name or last_name i always get this error : <code>ReferenceError: email is not defined</code> in console, which means my ajax function is not getting any variable named email inside scope of testAPI(). So finally my question is how to get variables other than name, so that i can sent these var as argument in data of ajax call AND access on index.php page so i can use these variables i got from $_POST to insert into database for user registration on my webapp? got this from tutorials on <a href="https://developers.facebook.com/docs/facebook-login/web/#example" rel="nofollow noreferrer">facebook's tutorial</a></p>