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

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(function(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!

Answers:

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.