Grabbing Free Data From Reddit In A Browser

How To Use The Open Reddit JSON API With jQuery

For those who didn't know already... Reddit offers it's data for subreddits publically. You can access this data by simply adding .json to the end of the subreddit url like so

Let's grab this data using jQuery and display some lovely data. I've written a simple function that you can throw your variables at.

function getReddit(sub, order, limit) {
  $.getJSON(`${sub}/${order}.json?limit=${limit}`, function(data) {
    $.each(, function(i, item) {
      var title =;
      var url =;
      $('body').append(`${title} - ${url}<br>`)

And using it goes a little something like this getReddit(subreddit, order, limit);. Here's an example...

getReddit('all', 'new', 100);

Thanks for reading. x