From b093315c4f9de9ed25ea202e00a34ef3c843c9f2 Mon Sep 17 00:00:00 2001 From: Jainam Date: Wed, 13 Dec 2023 15:13:51 +0530 Subject: [PATCH] added location coordinates --- index.html | 4 +++- script.js | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 333b617..543440c 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,8 @@ - + + @@ -39,6 +40,7 @@

Search for any cit
+
diff --git a/script.js b/script.js index 92cc530..84d3e7b 100644 --- a/script.js +++ b/script.js @@ -22,6 +22,7 @@ function getResults(query) { fetch(`${api.base}weather?q=${query}&units=metric&APPID=${api.key}`) .then(response => { if (!response.ok) { + console.log(response) if (response.status === 404) { throw new Error("City not found") } else { @@ -57,6 +58,10 @@ function displayResults(weather) { city.innerText = `${weather.name}, ${weather.sys.country}` + let coords = document.querySelector('.location .coords') + + coords.innerText = `Co-ordinates: Lat:${weather.coord.lat}, Lon:${weather.coord.lon}` + let now = new Date(); let date = document.querySelector('.location .date') date.innerText = dateBuilder(now);