-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
39 lines (34 loc) · 979 Bytes
/
index.js
File metadata and controls
39 lines (34 loc) · 979 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
29
30
31
32
33
34
35
36
37
38
39
// Day 1 code
$('.add-gif').on('click', function() {
let gif = $('.gif-link').val();
$.ajax({
url: 'http://localhost:5000/add?gif=' + gif,
type: 'GET',
success: function(data) {
window.location.href = 'http://localhost:5500';
}
});
});
$(document).on('click', '.count', function() {
let count = $(this).text();
count++;
$(this).text(count);
});
// Day 2 code
// create an ajax request to localhost:5000
$.ajax({
url: 'http://localhost:5000',
type: 'GET',
success: function(data) {
data.forEach(element => {
let str = `<div class="card1 border m-2">
<img class="card-img-top" src="${element.link}" alt="Card image" style="width:100%">
<div class="card-body">
<h4 class="card-title name">Gif By BB17G</h4>
<span><span class="count">0</span> Likes ❤️</span>
</div>
</div>`
$('.gifs').append(str);
});
}
});