Displaying posts of a subreddit

Before proceeding further, let's discuss the reddit API. Reddit provides a REST-based API and multiple response formats for the data. Out of these, the simplest is adding .json to a URL and accessing it. Adding .json at the end of any URL will get us the JSON object for that page. You can try it yourself. If you want to get the JSON for webdev subreddit, enter the URL http://reddit.com/r/webdev.json in your browser and you will see the JSON response. If you want to see the formatted JSON, use Google Chrome. Similarly, to get the comments JSON for any particular post, the URL becomes http://reddit.com/comments/XYZ.json, where XYZ is the id for that post. You will learn how to find the id as well in this section. ...

Get Mastering jQuery UI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.