Show the local weather app

Please help me figure out why my weather app is not changing the my longitude and latitude variables.

Actually the problem seems to be on your watchPosition method, that doesn’t seem to be working.
I used getCurrentPosition for mine. In your code latitude and longitude are given as undefined, that’s why it fails.

I’ve done that but the problem persists

Right, it seems that this needed a bit of tinkering. Apparently the function inside getCurrentPosition is not capable of modifing variables outside of itself (I don’t realy know why).

First declare the variables latitude and longitude with the keyword var inside the getCurrentPosition function and get rid of the global ones.

Second move your getJSON function inside the getCurrentPosition function (forget about the document. ready).

That should make everything live inside the same function scope. it does work for me now and it has the right location.

Give it a try and let me know. If you need I can post the code here.

It worked and i’m immeasurably grateful for your help, thanks a million!