Hey everyone,
i do the following query to get a user statuses:
FB.api(
{
method: 'fql.query',
query: 'SELECT message FROM statuses WHERE uid = ' + userId
},
function(data) {
// do something with the response
}
);
It works great when the number of result are more than 0.
but when there are no results, the callback function is not called at all.
i need to know if there are 0 rows returning from this query, is there any way to do it?
Thanks 🙂
First of all, the
statusestable does not exists. You should be usingstatustable.The callback is always called but you should properly check against empty objects. Just paste this on the Javascript Test Console:
Here I am checking for statuses before 1/1/1980 to insure that an empty result is returned. In your console you should note the
data is emptyresponse.