I'm testing how all the facebook api calls work, and I need to know how it is possible to print user_friends on a page, after the user gives permission.
I wrote this code, in order to try and print the user_friends feilds:
function testAPI() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log('Successful login for: ' + response.name);
document.getElementById('status').innerHTML =
'Thanks for logging in, ' + response.user_friends + '!';
});
}
At the end, I added response.user_friends, however I don't get the user friends list printed on the page, instead I get "undefined".
If I change it to response.name, it work and the name of the user is printed.
P.S. In the log in button I requested the user friends list:
<fb:login-button scope="public_profile,email,user_friends" onlogin="checkLoginState();">
</fb:login-button>
It is just a test for me to understand how the user_friends look like, I'm not going to do so in the actual app. So Why I'm not getting the user_friends printed at the page?
Thanks