Skip to content

Instantly share code, notes, and snippets.

@jonathanmeaney
Created December 9, 2011 20:05
Show Gist options
  • Save jonathanmeaney/1453069 to your computer and use it in GitHub Desktop.
Save jonathanmeaney/1453069 to your computer and use it in GitHub Desktop.
Using google books rest api to search for books
<script>
function view_books()
{
$.getJSON('https://www.googleapis.com/books/v1/volumes?q=food+allergies&maxResults=5', function(data) {
var items = [];
$.each(data, function(key, val) {
items.push('<li id="' + key + '">' + val + '</li>');
});
$('<ul/>', {
'class': 'my-new-list',
html: items.join('')
}).appendTo('body');
});
}
function view_books2()
{
$.ajax({
url: "https://www.googleapis.com/books/v1/volumes?q=food+allergies&maxResults=5",
dataType: "json",
success: function(){
}
});
}
</script>
<button onclick="view_books();">Click</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment