How to get user location and user hometown in facebook api?

I am already using this script but I didn't get hometown and location when I use API the hometown and location is undefined message appears please give example code and how to get user mobile number in Facebook API:

function login() {
FB.login(function(response) {
    if (response.authResponse) {
        // connected
    } else {
        // cancelled
}, { scope: 'email,user_birthday,user_location,user_hometown' });
function testAPI() {
console.log('Welcome!  Fetching your information.... ');
FB.api('/me', function(response) {
    console.log('Good to see you, ' + + '.' + ' Email: ' + + ' Facebook ID: ' +;
  //console.log('Good to see you, ' + + '.');
  var userfirstName=response.first_name;
  var lastName=response.last_name;
  var usersex=response.gender;
  var userbithday=response.birthday;
  var hometown=;
  var location=;




 <fb:login-button show-faces="false" width="200" max-rows="1"     scope="email,user_birthday,user_location,user_hometown" onclick="testAPI();" onlogin="'onlogin callback')">
     Sign Up with Facebook

but can't get hometown and location, please help give any example.


You are using wrong permissions, try this:

{ scope: 'email,user_birthday,user_location,user_hometown' }

Another thing, to access the hometown use this:

var hometown=;

Also, instead of /me; mention explicitly the fields you want using the fields parameter; just like: /me?fields=hometown

Graph API Explorer

Need Your Help

Counting palindromic substrings in O(n)

algorithm string optimization count

Given a string (assume only English characters) S of length n, we can count the number of palindromic substrings with the following algorithm:

String to timestamp in mysql

mysql sql timestamp

Is there any way to convert string to UNIX timestamp in MySQL?