Using freecodecamp's weather api

I have tried to use this app in codepen to do the show the local weather challenge.
However codepen just act’s like there’s no such api. or as if the api had no data in.

I have researched this on the web and heard something about security and something about the api being a twitch. So I feel that the more I find out the less I know.

Could you link to an example of something you’ve tried in Codepen?

how do i do that?..

Copy the URL of your CodePen project and paste it here. Without seeing the actual code, it is quite difficult to help.

Here is the url to my pen

My pen is not yet a complete attempt at the challenge but a lab for mastering principles of it.

The variable called doing is supposed to take in the value of weather[0].main from the JSON
and contain something like “rain” for instance.

Using console.log(weather) after your call to the api, here’s what the api returned.

Object {
error: “Please provide longitude as lon and latitude as lat as numbers/floats.”

First of, learn to read the console! Seriously, that is a coders best friend.

As bodhi points out, the error means that you’re sending it the wrong string.


You’re not injecting the values you got. You need something like:

"" + lat + "&lon=" + lon

so that those values get put into your API string.

1 Like

I would also point out that you’re going to run into an asynchronous problem - that $getJSON needs to be inside the callback to the geolocation or the $getJSON is going to run before those values are set. This recent thread discusses a similar issue.

These bones you have given me don’t give me the vision of any dinosaur.

How and where have you found all your dinosaurs?

I don’t believe that anything in free code camp would be all that difficult if only we could find things to
learn from.

I don’t think any of us found the dinosaurs for a while. It takes time and patience. Web Development is a complicated endeavour. You will get there with perseverance and practice. Being able to do research is a huge component in your learning experience. Also, you will find many answers to your questions on this forum if the questions are pertinent and specific. Good luck in your studies!

1 Like

Can someone please tell me what I am doing wrong? There’s absolutely nothing showing up on my console and nothing showing up in the li tags either.
Here is the url to my code: