Most importantly take a look at the style. I’m using globals since the it seems more clear this way, but I am aware it is considered bad practice.
when I run it I get an error in the console “error: cannot read property ‘done’ of undefined.” I guess the function should return a value which is a promise. But how do I do that? Looking for best practices.
$(document).ready(addLocToUrl()); … now you call just one function here
remove your global var url = … and instead place it directly under the following line of code
$.getJSON(‘http://ipinfo.io/json’, function(result){
and then under this line of code $(’#z’).text(url); paste getWeather(url);
Havent use .done before so not going to try explain why your way fails … recommend reading up on promises and watching some videos on them for JSON and ajax as they are good. This week i rewrote my weather app to use promises for practice as i hadnt used them originally.