-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
35 lines (30 loc) · 1.01 KB
/
app.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
35
async function getshow(x){
const res = await fetch(`https://api.tvmaze.com/search/shows?q=${x}`);
const data = await res.json();
console.log(data);
for(naa of data){
try{
console.log(naa.show.name);
console.log(naa);
let img = document.createElement("img");
let an = document.createElement("a");
an.href = naa.show.officialSite;
let figcaption = document.createElement("figcaption");
let figure = document.createElement("figure");
figcaption.innerText = naa.show.name;
img.src = naa.show.image.original;
document.querySelector("#results").appendChild(figure);
an.append(figcaption);
figure.append(img);
figure.append(an);
}catch{
}
}
}
const inpu = document.querySelector('input');
const bt = document.querySelector("#s");
const c = document.querySelector("#c");
bt.addEventListener("click" , () => {
getshow(inpu.value);
})
c.addEventListener('click' , () => window.location.reload());