Reputation: 14038
I'm playing around with Facebook's JS SDK and FQL, trying to get results for some queries, the first two queries I try (fql) work perfectly fine, the latter half don't work.
If I call FB.getAccessToken() and retrieve my current session's access token, then use that access token to ping the FQL endpoint it works:
https://api.facebook.com/method/fql.query?query=SELECT+name,+is_app_user+FROM+user+WHERE+uid+IN+(SELECT+uid2+FROM+friend+WHERE+uid1+=+ 504405294)&access_token=#############&format=json
Anyone know why it doesn't work when using the FB JS SDK?
// var fql = 'SELECT pic_square, uid FROM user WHERE uid = 504405294 OR uid = 100002624783324 OR uid = 1634269784 OR uid = 100002917463525';
var fql = 'SELECT name, pic_square, sex FROM user WHERE uid = 100002624783324';
// var fql = 'SELECT name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())'; //ORDER BY is_app_user DESC LIMIT 0, 1000';
// var fql = 'SELECT uid2 FROM friend WHERE uid1 = 504405294';
console.log(fql);
var query = FB.Data.query(fql);
query.wait(function(rows){
console.log(rows);
});
Edit
To be a little more clear, the console.log(rows); call in .wait() never happens. The console is blank.
Upvotes: 3
Views: 1649
Reputation: 11
Hello you must write some like this:
FB.api('/me', function(user) {
this.query = FB.Data.query("SELECT name, pic_square, sex FROM user WHERE uid =me()", user.id);
this.query.wait(function(rows) {
console.log(rows);
});
});
Upvotes: 1