[SOLVED] Can someone look at my Local Weather App code?

I set up my location, but it won’t show in my html. Also, I might not nave my ajax working correctly. Would appreciate another set of eyes. Thanks in advance.

Pen: https://codepen.io/BlackMG27/pen/rzWqgY
API that I used: http://ip-api.com/docs/api:json

Thanks for the link! I tried adding getLocation() to getAll() using .bind() and .apply(), but I kept getting Uncaught TypeError: Cannot read property 'apply' of undefined referring to getLocation() .

getAll() executes the function then .apply is used on what that function returns, since getAll isn’t returning anything it is undefined.
getLocation is in the scope of getAll and can be called inside of it, however getLocation is not accessible outside of getAll.

function foo(){
    function bar(){
foo() // bar
bar() // Reference Error bar is not defined

When using call, bind, apply use fn.bind() , fn.call(), fn.apply(), where fn is the function name.


I fixed the issue…for the most part. Do we have to show the location’s country? If not, then I fixed it! Thank you so much!

1 Like

I have two more issues: I need some help with my weather icons and my switch button. The icons won’t show and the button doesn’t work. Thanks in advance.

line 135: forgot the . in $(“tempGet”);
Icons are working for me.

1 Like

I got the icons to work. I forgot to get the cdn. :yum: