需要帮助显示来自 FQL 查询 is_app_user 的超过 1 个响应或类似的解决方案

发布于 2024-12-04 01:36:26 字数 814 浏览 3 评论 0原文

我目前正在尝试通过 FQL 查询获取添加了相同应用程序的朋友列表。 我实际上是在为一个学校项目执行此操作,显然,PHP 不支持保存此内容的服务器。这就是我使用 JavaScript SDK 进行编码的原因。

这实际上是我第一次在 Facebook 上做一个项目,一切对我来说都是非常新的,并且图形 api 对我处理任何旧文档根本没有帮助,因为很多事情已经改变,文档非常稀缺> .<.

目前,我在显示多个结果时遇到问题(我只能在对响应进行硬编码时才能这样做)

我尝试使用 for 循环来打印结果,但无济于事。

FB.api('/me', function(response) {
showLoader(false);
var query       =  FB.Data.query('SELECT uid, name, pic_square FROM user WHERE uid 
IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND is_app_user');

query.wait(function(rows) {



for(var i = 0; i< rows.length;i++)
{ 
document.getElementById('debug').innerHTML =              
''+ rows[i].name +"<br />" + "<img src=\""+ rows[i].pic_square +"\" /><br />";
}
  }); 

    });

我在某种程度上做错了吗? >.<。任何帮助都会非常好! 谢谢!

I am currently trying to get a list of friends who have added the same app via the FQL query.
I am actually doing this for a school project, and apparently, the server where this is going to be saved is not supported via PHP.That is why i am using the JavaScript SDK to code this.

This is actually the first time that I am doing a project in Facebook and everything is extremely new to me and having the graph api is not helping with me with any old documentations at all since many things have been changed and documentation is very scarce >.<.

Currently, I am having problems displaying multiple results (i am only able to do so if i hard code the response)

I've tried using a for loop to print the result but to no avail.

FB.api('/me', function(response) {
showLoader(false);
var query       =  FB.Data.query('SELECT uid, name, pic_square FROM user WHERE uid 
IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND is_app_user');

query.wait(function(rows) {



for(var i = 0; i< rows.length;i++)
{ 
document.getElementById('debug').innerHTML =              
''+ rows[i].name +"<br />" + "<img src=\""+ rows[i].pic_square +"\" /><br />";
}
  }); 

    });

am i doing this wrong in any way? >.<. Any help would be reallllly great!!
Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别低头,皇冠会掉 2024-12-11 01:36:26

也许是因为您正在跨过调试 div 中放置的内容。 另外,尝试

document.getElementById('debug').innerHTML +=

一下,您不必有 for 循环。你可以让 facebook 使用他们的 forEach 函数来为你做这件事。

为了获得返回的多个结果,我这样做:

var linkquery = FB.Data.query('select owner, owner_comment, url from link where owner={0}', response.id);
FB.Data.waitOn([linkquery], function() {
  FB.Array.forEach(linkquery.value, function(row) {
    document.getElementById('debug').innerHTML += 'FQL Information: '+  "<br />" + 
      'Your name: '      +  row.owner + "<br />" +
      'Your comment: '   +  row.owner_comment + "<br />" +
      'Your link: '      +  "<a href='" + row.url  + "'>" +  row.url  + "</a><br /><br />";
  });
});

FB.Array.forEach 获取每个 row.owner 并将它们添加到调试 div -

document.getElementById('debug').innerHTML += 

每行是回来了。

希望有帮助

Maybe it is the fact that you are stepping over what you are placing in the debug div. Try

document.getElementById('debug').innerHTML +=

Also, you do not have to have a for loop. You can have facebook do it for you by using their forEach function.

To get multiple results returned, I do this:

var linkquery = FB.Data.query('select owner, owner_comment, url from link where owner={0}', response.id);
FB.Data.waitOn([linkquery], function() {
  FB.Array.forEach(linkquery.value, function(row) {
    document.getElementById('debug').innerHTML += 'FQL Information: '+  "<br />" + 
      'Your name: '      +  row.owner + "<br />" +
      'Your comment: '   +  row.owner_comment + "<br />" +
      'Your link: '      +  "<a href='" + row.url  + "'>" +  row.url  + "</a><br /><br />";
  });
});

The FB.Array.forEach gets each row.owner and they are being added to the debug div -

document.getElementById('debug').innerHTML += 

with each row that is returned.

Hope that helps

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文