【发布时间】:2011-05-12 09:50:44
【问题描述】:
我一般是编程新手,当我调用moviedb.org api 时,我无法将数据导入我的网络应用程序。我正在使用 jquery,我已经阅读了所有文档,甚至是食谱,我仍在努力完成这项工作,我还检查了我的谷歌开发工具控制台,它显示调用成功:
Status Code:200 OK
[{"id":550,"name":"Fight Club","posters":[{"image":{"type":"poster","size":"original","height":1000,"width":675,"url":"http://hwcdn.themoviedb.org/posters/f8e/4b........
这是我的代码:
<script>
$.getJSON("http://api.themoviedb.org/2.1/Movie.getImages/en/json/ed7e2e092ca896037ce13d2bf11a08f1/550&callback=?",
function(data){
$.each(data, function(i,item){
$("<img/>").attr("src", item.image).appendTo("#images");
});
});
</script>
我想我搞砸了回调函数,任何想法都将不胜感激。 提前致谢!
【问题讨论】:
-
API 的
api.themoviedb.org/2.1版本不支持JSONP。 Their docs says it is supported in the version 3 API:Unlike previous versions of the API, /3 only supports a single format, JSON. XML and YAML support are being officially dropped. This lets us focus on improving 1 single type and also increases our ability to reuse cached data. JSONP is also officially supported, just add a callback parameter and you’re done.