-
Notifications
You must be signed in to change notification settings - Fork 0
/
myscript.js
20 lines (20 loc) · 912 Bytes
/
myscript.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function getInputValue(){
var inputVal = document.getElementById("myInput").value;
var image = document.getElementById('flag')
image.style.display = "inline-block";
fetch("https://corona.lmao.ninja/v2/countries/"+inputVal)
.then((response) => {
return response.json();
})
.then((data) => {
console.log(data);
document.getElementById("flag").src = data.countryInfo.flag;
document.getElementById("country").innerHTML = data.country;
document.getElementById("Active_Cases").innerHTML = data.active;
document.getElementById("Total_Cases").innerHTML = data.cases;
document.getElementById("Critical_Cases").innerHTML = data.critical;
document.getElementById("Total_Death").innerHTML = data.deaths;
document.getElementById("Recovered_Cases").innerHTML = data.recovered;
document.getElementById("Total_Test_Done").innerHTML = data.tests;
});
}