Format JSON Data to Display Results
Learn to format JSON returned by the WordPress REST API.
We'll cover the following
Formatting JSON data
Open the Search.js
file from the modules folder inside the src folder. The Search
class has a sendSearchRequest
method which sends a request to the WordPress REST API. We will work on displaying the results in this lesson.
In the previous lesson, we displayed the title of the posts on the console. Now we will adjust the markup of the search-results
div to display the title under the input box. The sendSearchRequest
method from the last lesson is reproduced below:
Get hands-on with 1400+ tech skills courses.