I am trying to get an estimate for a specific url from reddit. To add the "share with reddit (count)" link:
function redditCounter(url) { // Get number of counts from reddit JSON api // $.getJSON('http://www.reddit.com/api/info.json?url='+url+'', $.getJSON('http://www.reddit.com/api/info.json?url=http://stackoverflow.com/q/811074/1288', function(data) { count = 0; if (data.children.count() > 0) { first_child = data.children[0]; alert(first_child.score); } }); }
When you invoke the URL using curl or your browser, the result looks as described in the Reddits API documentation . There is an array for children that contains a grade with a number.
$.getJSON , however, returns an empty response, observed when passing through it to firebug.
Perhaps this is a reddit protection method? Or am I using getJSON incorrectly?
source share