I have a facebook application where I need to get the name, category list of user like pages.
I have added 'user_likes' to my permission list and successfully got the permission to access user like page list.
What I want to know is how to access these details and assign them into variables?
I tried bellow code
FB.Event.subscribe("auth.login", function (response) {
FB.api('/me/likes', function(user) {
if (user) {
var pageCount = user.data.length; //just try to get the length to check wheter it works
// I want to add name and category into variables here
});
});
And it assign '184' to the pageCount which means it works. I want to access name and category list
Can anyone please tell me how to do this?
Just used bellow code to get the data
FB.Event.subscribe("auth.login", function (response) {
FB.api('/me/likes', function(user) {
if (user) {
var pageCount = user.data.length;
var pageName = user.data[0].name;
var pageCategory = user.data[0].category;
});
});
This will assign the name and category of first liked page, use for loop to get all data
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.