Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get all movies from OMDb?

Tags:

ajax

http

So I can get a single query with, for example:

`http://www.omdbapi.com/?t=inception`

How do I get all the movies from the api?

like image 971
mrtaz Avatar asked Jan 04 '23 07:01

mrtaz


1 Answers

You can't get all the movies from OMDb API, even if you use * it will return an error Too many results.

But you can return multiple results using s parameter. Look at the code sample below using jQuery.

<!DOCTYPE html>
<html>
  <head>
    <title>Ajax Request</title>
  </head>
  <body>

    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
    <script>
      $.get("http://www.omdbapi.com/?s=inception&apikey=[yourkey]", function(data) {
        console.table(data);
      });
    </script>
  </body>
</html>

Check your browser console to view the result.

like image 162
Aminu Kano Avatar answered Jan 13 '23 15:01

Aminu Kano