My javascript solution for pulling in the likes for a set of links on a certain page is no longer working. I can’t find anything wrong, and I’ve tried using the .api() method (below) and the Data.query() method but neither is working. This is the code that I currently have and it’s similar to what I was using when it was working.
var inlist = [url1, url2, url3..... urln];
FB.api(
{
method: 'fql.query',
query: 'SELECT url, total_count FROM link_stat WHERE url IN('+inlist.substr(0, inlist.length-2)+')'
},
function(response) {
console.log(response);
for( var i = 0 ; i < response.length ; i++ ) {
if (response[i]['total_count'] > 0){
$(vids[response[i]['url']]).append("<div class='likes'>"+response[i]['total_count']+"</div>");
}
}
}
);
The console reports nothing, my FB object is initialized correctly (the example queries run with no problem), and the URL’s are generated dynamically based on a list of links. Also, it’s worth mentioning that I tested the FQL here:http://developers.facebook.com/docs/reference/rest/fql.query/ and it worked fine…
Looks like the problem was that I was including too many IN(…) items. Oddly enough though there was no error, just no response. I limited the items in to 10 and everything started working again.