Make an FQL query directly from the client. FQL is the most efficient way to request data in Javascript. Almost all other read methods can be expressed as FQL queries.
Your callback will receive an array of row objects. Each object has keys corresponding to your selected query. For instance, in this query:
SELECT name,pic FROM user WHERE uid=211031
The response comes back:
[{name:"Ari Steinberg", pic:"http://profile.ak.fbcdn.net/v222/1805/47/s211031_4533.jpg"}]
Make the above query and show it in an alert.
FB.Facebook.apiClient.fql_query("SELECT name, pic FROM user WHERE uid=211031",
function(rows) {
alert("Hello, " + rows[0].name);
});
| query | String | an FQL query. |
| onRequestCompleted | Object | a callback function for immediate execution, or an instance of FB.BatchSequencer |