From 7bf06527f444aaccc933b2adc88926e1f7913fe8 Mon Sep 17 00:00:00 2001 From: kcee917 Date: Sat, 13 Feb 2021 12:32:29 -0500 Subject: [PATCH 1/3] Update files --- index.html | 8 +++++--- weather.css | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 weather.css diff --git a/index.html b/index.html index 3233671..b005ced 100644 --- a/index.html +++ b/index.html @@ -3,9 +3,11 @@ - Document + Weather App -

Hola Mundo

+

Weather App

+

+ - \ No newline at end of file + diff --git a/weather.css b/weather.css new file mode 100644 index 0000000..69797b6 --- /dev/null +++ b/weather.css @@ -0,0 +1,19 @@ +// step 1 - create response object +let zipCode = new XMLHttpRequest(); +let zip = prompt("enter zipcode to get city & state"); + + +// step 2 - create call back + zipCode.onreadystatechange = function() { + if (zipCode.readyState === 4 && zipCode.status === 200) { + let response = JSON.parse(zipCode.responseText); + console.log(response); + let city = response.places[0]["place name"]; + let state = response.places[0]["state abbreviation"]; + document.getElementById('location').innerHTML = city + ", " + state; + } + } +// step 3 - create an open request + zipCode.open('GET', `http://api.zippopotam.us/US/${zip}`); +// step 4 - send the request + zipCode.send(); From 592fbf5074bb81e6369463bf3f5b2c3636ec3f98 Mon Sep 17 00:00:00 2001 From: kcee917 Date: Sat, 13 Feb 2021 14:13:56 -0500 Subject: [PATCH 2/3] update files --- weather.JSON | 11 +++++++++++ weather.css | 3 --- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 weather.JSON diff --git a/weather.JSON b/weather.JSON new file mode 100644 index 0000000..93338fe --- /dev/null +++ b/weather.JSON @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/weather.css b/weather.css index 69797b6..a6efed4 100644 --- a/weather.css +++ b/weather.css @@ -1,9 +1,6 @@ -// step 1 - create response object let zipCode = new XMLHttpRequest(); let zip = prompt("enter zipcode to get city & state"); - -// step 2 - create call back zipCode.onreadystatechange = function() { if (zipCode.readyState === 4 && zipCode.status === 200) { let response = JSON.parse(zipCode.responseText); From b326a3432da020a58b5cb3fb110e0f2002de8f5a Mon Sep 17 00:00:00 2001 From: kcee917 Date: Fri, 26 Feb 2021 14:01:45 -0500 Subject: [PATCH 3/3] push code --- .vscode/settings.json | 3 +++ index.html | 7 +++++++ weather.css | 16 ---------------- weather.js | 19 +++++++++++++++++++ 4 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 weather.js diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f673a71 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5502 +} \ No newline at end of file diff --git a/index.html b/index.html index b005ced..dec8594 100644 --- a/index.html +++ b/index.html @@ -6,8 +6,15 @@ Weather App +

Weather App

+
+ + + +
+
diff --git a/weather.css b/weather.css index a6efed4..e69de29 100644 --- a/weather.css +++ b/weather.css @@ -1,16 +0,0 @@ -let zipCode = new XMLHttpRequest(); -let zip = prompt("enter zipcode to get city & state"); - - zipCode.onreadystatechange = function() { - if (zipCode.readyState === 4 && zipCode.status === 200) { - let response = JSON.parse(zipCode.responseText); - console.log(response); - let city = response.places[0]["place name"]; - let state = response.places[0]["state abbreviation"]; - document.getElementById('location').innerHTML = city + ", " + state; - } - } -// step 3 - create an open request - zipCode.open('GET', `http://api.zippopotam.us/US/${zip}`); -// step 4 - send the request - zipCode.send(); diff --git a/weather.js b/weather.js new file mode 100644 index 0000000..59d255c --- /dev/null +++ b/weather.js @@ -0,0 +1,19 @@ +/* step 1 - create response object */ +var zipCode = new XMLHttpRequest(); +var zip = prompt("Enter zipcode to get city & state"); + + +/* step 2 - create call back */ + zipCode.onreadystatechange = function() { + if (zipCode.readyState === 4 && zipCode.status === 200) { + let response = JSON.parse(zipCode.responseText); + console.log(response); + let city = response.places[0]["place name"]; + let state = response.places[0]["state abbreviation"]; + document.getElementById('location').innerHTML = city + ", " + state; + } + } +/* step 3 - create an open request */ + zipCode.open('GET', `http://api.zippopotam.us/US/${zip}`); +/* step 4 - send the request */ + zipCode.send(); \ No newline at end of file