开发者

get just a list with friends that are online - FACEBOOK jsSDK

开发者 https://www.devze.com 2023-03-27 23:05 出处:网络
Im trying to get a simple list with just the names of friends that are online right now in javascript with the facebook jsSDK. As looked through attemps here, i\'m using FQL to query them ... if there

Im trying to get a simple list with just the names of friends that are online right now in javascript with the facebook jsSDK. As looked through attemps here, i'm using FQL to query them ... if there is a better solution, let me know.

App is asking for permissions correctly, jsSDK initializes correctly, i could even manage to query for the current users name like this:

var query = FB.Data.query('select name, uid from user where uid={0}', <?php echo $data['user_id']; ?>);
query.wait(function(rows) {
    document.getElementById('display').innerHTML =
    'Your name is ' + rows[0].name;
});

However if i use the query recommended from a guy here it does not even execute the callback function:

var query = FB.Data.query('SELECT name,uid FROM user WHERE online_presence IN ("active", "idle")',<?php echo $data['user_id']; ?>);
query.wait(function(rows){
    document.getElementById('display').innerHTML =
    'Name of fist online friend ' + rows[0].name;
});

After jumping to the query.wait method, it does nothing ... not even execute the callback function ...

If anybody is familiar with this, maybe you have a tip for me!

Thx haemse

EDIT:

Ok tried it now like the guy suggests:

var queryOnFriends = "SELECT uid, name, online_presence, status FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = '" + <?php echo $data['user_id']; ?> + "')";
var queryUserName = "select name, uid from user where uid={0}";

var query = FB.Data.query(queryOnFriends, <?php echo $data['user_id']; ?>);
query.wait(functio开发者_开发百科n(rows) {
    document.getElementById('display').innerHTML =
    'Your name is ' + rows[0].name;
});

still same thing ... where can i see how this "tables" from facebook look like and how these queries work ... didn't find anything in the developer section ... ???

still not executing the callback!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号