- Testing FQL Queries
- Finding the User's Friends
- Finding the User's Links
- Executing the FQL Queries
- Putting It All Together
Executing the FQL Queries
FQL queries are executed with the FB.Facebook.apiClient.fql_query() function, which takes two parameters:
- FQL query to execute
- Callback function called after the query has been executed
The callback function receives the retrieved data as its only parameter. However, the format of the results might vary:
- If the query has been executed successfully and returned at least one result row, the data passed to the callback function is an array of objects.
- If the query is valid but didn't return any results, an empty object is passed to the callback function.
If you pass an invalid query to the fql_query function, the Facebook Connect library throws an exception after receiving an unexpected reply from the server. However, as of this writing there's no way to catch the exception, as it occurs in the cross-domain receiver code, which is an independent web page in a hidden IFRAME.