需要帮助显示来自 FQL 查询 is_app_user 的超过 1 个响应或类似的解决方案
我目前正在尝试通过 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许是因为您正在跨过调试 div 中放置的内容。 另外,尝试
一下,您不必有 for 循环。你可以让 facebook 使用他们的 forEach 函数来为你做这件事。
为了获得返回的多个结果,我这样做:
FB.Array.forEach
获取每个row.owner
并将它们添加到调试 div -每行是回来了。
希望有帮助
Maybe it is the fact that you are stepping over what you are placing in the debug div. Try
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:
The
FB.Array.forEach
gets eachrow.owner
and they are being added to the debug div -with each row that is returned.
Hope that helps