Got co-ords, how to get weather?

I can get my co-ordinates but how do I get the weather? We’re given this:
but I don’t what it means or how to use it.



I can not get coordinates with your code, because you have not added the jQuery library to your Codepen JS settings.

Also, you are missing a > on the first line of your html (see below).

<body class="body-attr" // missing a > at the end of this line.

As far as using the FCC API to get weather data, if you read the instruction on the API, you simply use the following link. I have substituted the values of my longitude and latitude below. You will need to concatenate the applicable values received back from the call to navigator.geolocation.getCurrentPosition to generate the actual url string in which you will make another call to the FCC api.

Thanks Randell

long & lat: aren’t I doing that in the JS section?
do I just assign all that last bit to a variable?


The navigator.geolocation.getCurrentPosition is asynchronous, so it does prevent other code from executing before the long and lat data come back from it. What this means is url you build (" + position.coords.latitude + “&lon=” + position.coords.longitude) does not have access to the position variable that was inside the navigator.geolocation.getCurrentPosition callback function. Any code which references position needs to be put inside the navigator.geolocation.getCurrentPosition callback function.

If you look at your browser’s console (Ctrl+Shft+J in Chrome) you would have seen the following error message:
Uncaught ReferenceError: position is not defined at pen.js:16

The reference error happens because position is local to the navigator.geolocation.getCurrentPosition callback function.