-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjquery.js
More file actions
30 lines (24 loc) · 820 Bytes
/
jquery.js
File metadata and controls
30 lines (24 loc) · 820 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
26
27
28
$(document).ready(function() {
$('#app').prepend('<img src="images/logo.png" alt="logo"/>')
.append('<div class="container"></div>');
const url = 'https://ghibliapi.herokuapp.com/films';
$.get(url).done(function(data) {
data.forEach(movie => {
$('.container').append(
'<div class="card">'
+ '<h1>' + movie.title + '</h1>'
+ '<p>' + `${movie.description.substring(0, 500)}...` + '</p>'
+ '</div>'
);
});
})
.fail(function(error) {
$('.container').append(
'<div class="card">'
+'<h1>Oh, no! Something went wrong!</h1>'
+'<p>' + error.status + ': '
+ ' ' + error.statusText + '</p>'
+'</div>'
);
});
});