所以我可以得到一个单一的查询,例如:
`http://www.omdbapi.com/?t=inception`
Run Code Online (Sandbox Code Playgroud)
如何从api获取所有电影?
你不能从 OMDb API 获取所有的电影,即使你使用*它也会返回错误Too many results.
但是您可以使用s参数返回多个结果。使用 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>
Run Code Online (Sandbox Code Playgroud)
检查您的浏览器控制台以查看结果。