-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
23 lines (20 loc) · 951 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const cardContainer = document.getElementById('card-wrapper');
const url = 'user_data.json';
// Get data by featch from json file. Your website should stay in a server to enjoy this featch data.
fetch(url)
.then(response => response.json())
.then((val) => {
let row = val.map((data) => {
return ` <div class="card">
<div class="card__inner">
<h2 class="card__name">${data.name}</h2>
<h4 class="card__title">${data.title}</h4>
<img class="card__img" src=${data.avatar} alt="">
<p class="card__desc">${data.para}</p>
<a class="card__cta" href="#">Explore <span class="card__cta-arrow">→</span></a>
</div>
</div>`;
});
row = row.join(' ');
cardContainer.innerHTML = row;
});