Open ggtenev opened 4 years ago
It's hard coded I believe. You'll need to implement pagination using the totalResults
value
For an individual search, it looks like the API returns a maximum of 10 results per page, and your default search has an implicit "&page=1" at the end of it.
So your first search might go something like:
JavaScript:
(apiUrl + "&s=" + your-search-term)
where apiUrl
is your personal OMDb API key URL. This is the same thing as searching:
JavaScript:
(apiUrl + "&s=" + your-search-term + "&page=1")
So if you want to get the next set of results, you would need to iterate that page number upwards. You could build something like pagination in a series of buttons at the end of your search results like you see on a retail site.
If you want to display more than 10 results per search as a default, I suspect you'll need to send a double request. Your user would only "submit" once, but you would build your function to perform two searches, or however many you actually need.
You would then push those responses into a single array, and use that array to generate the displayed content. You could then manipulate that array if you wanted to present something other than multiples of ten.
You can get the total no. of results by using s=your_title_name example http://www.omdbapi.com/?i=tt3896198&apikey=your_api&s=title try this
You can get the total no. of results by using s=your_title_name example http://www.omdbapi.com/?i=tt3896198&apikey=your_api&s=title try this
what is this ?i=tt3896198 ?
what is this ?i=tt3896198 ?
This is a valid IMDb ID.
Any solution on how to get more results from API?
How do we get more than 10 results in our response object? I can't find any parameters for that