Skip to content

Instantly share code, notes, and snippets.

@DiyahM
Created September 23, 2015 23:50
Show Gist options
  • Save DiyahM/ae0fb617edaaefde15d9 to your computer and use it in GitHub Desktop.
Save DiyahM/ae0fb617edaaefde15d9 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Books</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
$(function() {
var i = 0;
var searchTerm = '';
function getBooks(subject, startIndex){
$.get('https://www.googleapis.com/books/v1/volumes', {
q: subject,
startIndex: startIndex,
maxResults: 20
}, function(data) {
//display all 20 results on page
});
});
}
function search(){
searchTerm = $('.searchBox').val();
getBooks(searchTerm, i);
}
$('.searchBtn').click(search);
});
</script>
</head>
<body>
<input type='text' class='searchBox'/>
<button class='searchBtn'>Search</button>
<div id='image-div'>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment