Show Local Weather - location/city not showing

Show Local Weather - location/city not showing
0

#1

Trying to pull data from the online API, the url tests fine, but the data is not showing. I have compared my codes with several similar projects, still couldn’t figure it out.

Here is my pen

Have been stuck for a few days. I just don’t get it… Any help would be appreciated, thanks!


#2

If you look at your browser’s console (Ctrl+Shft+J in Chrome) when you click the button, you will see the error message “Uncaught ReferenceError: $ is not defined” as it applies to the following line of code:

$.getJSON(apiurl,function(json){

Do you understand what the $ represents in your code?

Also, urls passed to getJSON should be have https:// in front of them to work with Codepen and most browsers.


#3

$ means jQuery?

I have added “https://” in front of the url.


#4

Yes, so you need to add jQuery to your project, so it will work.


#5

Thank you! I have added that in the pen settings. Thought it was all included…

It’s finally showing now. Thanks a lot!