Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Create aerisweather-datausingjquery.html
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseWx2011 authored Dec 14, 2023
1 parent e41b241 commit 887f319
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions my-scripts/aerisweather-datausingjquery.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!-- This is the JavaScript file -->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
// Script for showing the Place Name
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 place = json.response.place;
$('#placename').html('Weather Report for ' + place.name + ', ' + place.state + '');
}
else {
alert('An error occurred: ' + json.error.description);
}
});
});

// Script for showing the temperature
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;
$('#temperature').html('' + ob.tempF + '&deg;F');
}
else {
alert('An error occurred: ' + json.error.description);
}
});
});
</script>
<!-- This is the HTML file -->
<div id="placename" style="
font-family: Poppins; font-size: 26px;"></div>
<div id="temperature" style="
font-family: Arial, Bold; font-size: 53px;"></div>




<!-- This is the CSS File -->
<style>
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap");
</style>

0 comments on commit 887f319

Please sign in to comment.