0
我试图显示来自Google API的数据,但不断收到“undefined”作为结果。这里是我的代码:Google API Json Ajax/jquery调用
$(document).ready(function() {
var url='https://www.googleapis.com/books/v1/volumes?q=harry+potter&maxResults=9'
$('#button').click(function() {
$.getJSON(url,function(data){
$('#content').empty();
$.each(data, function(entryIndex, entry){
var html = '<div class="result">';
html += '<h3>' + entry['id'] + '</h3>';
html += '<div class="title">' + entry['title'] + '</div>';
html += '<div class="author">' + entry['author'] + '</div>';
$('#content').append(html);
});
});
return false;
});
});
谢谢你的帮助!但它似乎仍然没有工作:http://pixeloft.com/clients/popdust/ – user2140126 2013-03-07 04:05:56
我已经编辑了我的答案,在为您的网站的Javascript控制台做了一个自己的示例后,给你解决问题的方法。 – 2013-03-07 12:25:10
This Works!非常感谢! – user2140126 2013-03-07 14:09:49