For some reason, the variable for latitude is undefined outside of the getJSON function. The prototype of variable is outside the function, then inside I modify the value but when I use the console to check it it says undefinded (when used outside of the function).
I know there might be an easy solution to this but I genuinley tried searching for it but couldn’t find anything.
Here’s the code: http://codepen.io/kevlozano/pen/mmPqyL