I am trying to use the New York Times bestseller list API to list the current top 20 in html - I've managed to retrieve the data using ajax (I can see it using developer tools) but have got stuck trying to get it to display on the page. I don't get any error messages - nothing happens. This is my code as is:
<!DOCTYPE HTML>
<html>
<head>
<title>Discover Books</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<meta charset="UTF-8">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.js"></script>
<div id='books'>
</div>
</head>
<script>
$(document).ready(function(){
$.ajax ({
type: 'GET',
dataType: 'json',
url: 'http://api.nytimes.com/svc/books/v3/lists/hardcover-fiction?api-key=*API_KEY*',
success: function(response){
console.log(response);
for(var i = 0; i < response.length; i++) {
var listing = response[i];
$('#books').append('<h3>' + title + '</h3>');
}
},
error: function(xhr, status, error){
console.log(status);
console.log(error);
}
});
})
</script>
</html>
Any hints as to what I'm doing wrong? Thanks