Skip to content

Commit

Permalink
85% WORK DONE
Browse files Browse the repository at this point in the history
  • Loading branch information
MKAIF5 committed May 12, 2024
1 parent 1a5f76c commit cebb497
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ form.addEventListener("submit", (event) => {
}
});

let id = "9505fd1df737e20152fbd78cdb289b6a"
let url = "https://api.openweathermap.org/data/2.5/weather?units=metric&appid" + id
let id = "9505fd1df737e20152fbd78cdb289b6a";
let url =
"https://api.openweathermap.org/data/2.5/weather?units=metric&appid=" + id;

const searchWeather = () =>{
fetch(url )
.then(responsive => responsive.json())
.then(data =>{
console.log((data));
})
}
const searchWeather = () => {
fetch(url + "&q=" + getInput.value)
.then((responsive) => responsive.json())
.then((data) => {
console.log(data);
if (data.cod == 200) {
city.querySelector("figcaption").innerHTML = data.name;
city.querySelector("img").src = 'https://flagsapi.com/'+data.sys.country+'/shiny/32.png'

temperature.querySelector("img").src = 'http:openweathermap.org/img/wn/'+data.weather[0].icon+'@4x.png'
}
});
};

0 comments on commit cebb497

Please sign in to comment.