In this assignment, you will create a search and results page using Ajax and the Reddit API. The Reddit API endpoint you’ll be working with looks like this:
At the top of the page, create a form with a single search input and a submit button. When the user submits the form, fire off an Ajax request to get all the threads for the subreddit that was typed into the search box.
Note: Bind to the submit event on the form element instead of binding to the click event on the button.
When the Ajax request responds with the data, render the
author of each post. Each post can be found in
title should be an anchor tag that links to
url and opens in a new tab/window. Make sure that you are taking measures to protect against XSS attacks either by using DOMPurify or creating fragments and nodes.
While the Ajax request is pending, show a loading indicator on the screen using one of these CSS spinners.
- Create a
- Deploy your code to Surge and paste the URL on your
README.md. See this Markdown guide to learn how to create a link in Markdown.