I am having trouble with the local weather challenge
Here is the js code
var Weather;
var lat;
var lon;
var myURL;
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
lat = position.coords.latitude;
lon = position.coords.longitude;
myURL = "https://fcc-weather-api.glitch.me/api/current?lat=" + lat + "&lon=" + lon;
});
}
$(document).ready(function() {
$.getJSON(myURL, function(data) {
Weather = data;
$("#TEMP").html(Weather.main.temp);
});
});
how come my code wont work with $(document).ready(function() {whatever}); at the last couple of lines,but it works when I replace it with $(“h1”).click(function() {whatever});
And here is the html
<h1>This is the heading</h1>
<p>This is where we say what town you are in</p>
<p id="TEMP">The temperature</p>
<p>Description of the weather</p>
<p>Animation of the weather</p>
<p>Animation of the wind</p>