-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
34 lines (20 loc) · 845 Bytes
/
script.js
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
let container = document.querySelector(".container");
async function api_data(){
let api = await fetch("https://hp-api.onrender.com/api/characters");
let data = await api.json();
console.log(data);
for(let i=0;i<30;i++){
let card = `<div class="card">
<img src=${data[i].image} alt="character" >
<h3>${data[i].name}</h3>
<div class="info">
<span>${data[i].house}</span>
<p class="actorName">${data[i].actor}</p>
<p class="id">${data[i].id}</p>
<a target="_blank" href="https://www.google.com/search?q=${data[i].name}">Search on Web</a>
</div>
</div>`
container.innerHTML += card;
}
}
api_data();