From 8c281bee182911797aa912b4b5162ee3749f3ff1 Mon Sep 17 00:00:00 2001 From: "Jesse H. (JesseLikesWeather)" <134172009+JesseLikesWeatherakaYoshiKart@users.noreply.github.com> Date: Thu, 14 Dec 2023 12:41:39 -0500 Subject: [PATCH] Update aerisweather-datausingjquery.html --- my-scripts/aerisweather-datausingjquery.html | 94 +++++++++++++++++++- 1 file changed, 91 insertions(+), 3 deletions(-) diff --git a/my-scripts/aerisweather-datausingjquery.html b/my-scripts/aerisweather-datausingjquery.html index d13cf54..7f0de1f 100644 --- a/my-scripts/aerisweather-datausingjquery.html +++ b/my-scripts/aerisweather-datausingjquery.html @@ -16,7 +16,21 @@ } }); }); - + // Script for the weather observation + jQuery(document).ready(function($) { + $.ajax({ + url: "https://api.aerisapi.com/observations/andrews,md?client_id=Ok3aWX6hA5NczrIqqEzEz&client_secret=vVjMvIFvUUGx86dYlz4uCsqtIg4V47tVP8a6Kwf3" + }) + .done(function(json) { + if (json.success == true) { + var ob = json.response.ob; + $('#weatherobservation').html('Weather Condition: ' + ob.weather + ''); + } + else { + alert('An error occurred: ' + json.error.description); + } + }); + }); // Script for showing the temperature jQuery(document).ready(function($) { $.ajax({ @@ -32,17 +46,91 @@ } }); }); + // Script for the wind information + jQuery(document).ready(function($) { + $.ajax({ + url: "https://api.aerisapi.com/observations/andrews,md?client_id=Ok3aWX6hA5NczrIqqEzEz&client_secret=vVjMvIFvUUGx86dYlz4uCsqtIg4V47tVP8a6Kwf3" + }) + .done(function(json) { + if (json.success == true) { + var ob = json.response.ob; + $('#wind').html('The wind is blowing to the ' + ob.windDir + ' at ' + ob.windMPH + ' mph'); + } + else { + alert('An error occurred: ' + json.error.description); + } + }); +// Script for the wind dewpoint info + jQuery(document).ready(function($) { + $.ajax({ + url: "https://api.aerisapi.com/observations/andrews,md?client_id=Ok3aWX6hA5NczrIqqEzEz&client_secret=vVjMvIFvUUGx86dYlz4uCsqtIg4V47tVP8a6Kwf3" + }) + .done(function(json) { + if (json.success == true) { + var ob = json.response.ob; + $('#dewpoint').html('The Dew Point is ' + ob.dewpointF + '°, giving us the relative humidity of ' + ob.humidity + '%'); + } + else { + alert('An error occurred: ' + json.error.description); + } + }); + }); + }); + // Script for the barometer info + jQuery(document).ready(function($) { + $.ajax({ + url: "https://api.aerisapi.com/observations/andrews,md?client_id=Ok3aWX6hA5NczrIqqEzEz&client_secret=vVjMvIFvUUGx86dYlz4uCsqtIg4V47tVP8a6Kwf3" + }) + .done(function(json) { + if (json.success == true) { + var ob = json.response.ob; + $('#barometric-pressure').html('Barometric Pressure is ' + ob.pressureIN + '0 inHg'); + } + else { + alert('An error occurred: ' + json.error.description); + } + }); + }); +
+ - - + +