Why doesn't my CodePen show the Local Weather?

Why doesn't my CodePen show the Local Weather?
0.0 0


This is my codepen. I just put the api url into the JSON stringify, but there’s still no output. How do I get it to work?


1, your appID variable is a string and not a number, so you should use quotes
2, the $.getJSON() function’s first argument should be a URL starting with the protocol (https://)


You have a couple of issues to deal with here. First, the structure of your getJson request needs some attention. Look at the example on this page: http://www.w3schools.com/jquery/ajax_getjson.asp. Be sure your URL is a real URL (for example, https://whatever.com/etc)

The second big issue you need to correct is that once you make the correct call and data come back (after you fix the JSON call) you have no place for the data to show up.

I assume you want it to appear below your button. You must explicitly indicate where you want the data to go. I bet if you review your random quote generator project, it will be obvious to you. If no, give another shout. I know I struggled with that concept for quite a while, but once you get it, you will never forget it.

Best of luck,


He does have a div with a message class, that won’t be a problem. Did I miss something? :slight_smile:


Your third problem is with your link to openweather data, it should be: http://api.openweathermap.org/data/2.5/forecast?id=&appid= whereas you have api.openweathermap.org/data/2.5/forecast/city?id=&APPID=


Thanks, for the comments, I’m receiving the data now.


Let me try to clarify… There needs to be a pair of tags such as

as well as a corresponding js line such as $("#message").html(…

I do not see the Javascript portion of the pair in the correct format. Hope this helps.