How do I access the weather api and display the json content? I’ve been trying to figure this out for 5 days but no luck. Please help, thanks.
@camperextraordinaire Okay, I saw the console and I got the following reference error -
jQuery.Deferred exception: position is not defined" "ReferenceError: position is not defined
at HTMLDocument.<anonymous> (pen.js:52:69)
at j (https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js:2:29999)
at k (https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js:2:30313)" undefined
why is position not defined (if I delete it then my geolocation won’t work)?
When I try it I get a different error:
index.html:42 Uncaught ReferenceError: getWeather is not defined
at HTMLButtonElement.onclick (index.html:42)
onclick @ index.html:42
I believe it’s because the event listener is defined in the HTML whereas getWeather is a function local to $(document).ready. It’s out of scope. One way to fix it is to set up the event listener in $(document).ready.