Created
September 23, 2015 23:50
-
-
Save DiyahM/ae0fb617edaaefde15d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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