-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode_2.js
More file actions
25 lines (24 loc) · 802 Bytes
/
Copy pathcode_2.js
File metadata and controls
25 lines (24 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function reqListener () {
var response = JSON.parse(this.responseText);
for (var i = 0; i < 4; i++) {
var item = response.items[i];
var s =
`
<div class="col-md-3 col-sm-6 col-xs-12">
<h3>
${item.volumeInfo.title}
<br>
<small>${item.volumeInfo.authors.join(', ')}</small>
</h3>
<img class="img-responsive"
src="${item.volumeInfo.imageLinks.thumbnail}">
<p>${item.volumeInfo.description}</p>
</div>
`;
document.getElementById("content").innerHTML += s;
}
}
var request = new XMLHttpRequest();
request.addEventListener("load", reqListener);
request.open("GET", "https://www.googleapis.com/books/v1/volumes?q=malcolm+gladwell");
request.send();