In this assignment, let's build a Library Management page by applying the concepts we learned till now.
Refer to the image below
Completion Instructions
The following instructions are required for the tests to pass.
- Add an HTML input element with id searchInputinside an HTML container element
- Add an HTML container element with id searchResultsto display the search results from the HTTP response
By following the above instructions, achieve the given functionality.
- When a value is provided in the HTML input element with id searchInputandEnterkey is pressed,
- Make an HTTP GET request to the Books URL with the query parameter titleas the value of thesearchInputelement
- Make an HTTP GET request to the Books URL with the query parameter
- Loader should be displayed using the Bootstrap component spinnerwhile fetching the data
- After the data is fetched successfully, display the search results in the searchResultelement. If search results from HTTP response are:
- Empty, display "No results found" in the searchResultselement
- Non-empty, append the result items to the HTML container element with id searchResults. Each result item should consist of:
- An HTML image element with srcattribute value as the value of the keyimageLinkfrom HTTP response
- An HTML paragraph element with text content as the value of the key authorfrom HTTP response
Books URL: https://apis.ccbp.in/book-store
Example:
https://apis.ccbp.in/book-store?title=India
Query Parameter | Value |
---|---|
title | Value of the searchInput element. Example: India |
Method: GET
Description:
Returns a response containing the list of books with the title provided in the
searchInput
element.{
"search_results": [
{
"title": "Contours of India-EU Engagements",
"imageLink": "http://books.google.com/books/content?id=3OYrEAAAQBAJ&printsec=frontcover&img=1&zoom=1&edge=curl&source=gbs_api",
"author": "Neeta Inamdar"
},
...
],
"total": 20
}
#323f4b
#ffffff
Tags:
JavaScript Practice