[英]How to get facebook user liked page name, category list in javascript?
I have a facebook application where I need to get the name, category list of user like pages. 我有一个Facebook应用程序,需要在其中获取用户名称(例如页面)的类别列表。
I have added 'user_likes' to my permission list and successfully got the permission to access user like page list. 我已将“ user_likes”添加到我的权限列表中,并成功获得了访问用户(如页面列表)的权限。
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. 并将'184'分配给pageCount,这意味着它可以工作。 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 这将分配第一个喜欢的页面的名称和类别,使用for循环获取所有数据
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.