I'm trying to make a simple weather app and it seems I can't access any information using my variable for the JSON-link. Heres my code:
$(document).ready(function() {
var key = 'a91a892f1f2a1aa3f7409a78f72af675';
var locationURL = 'http://ip-api.com/json';
var longitude;
var latitude;
//Getting the geolocation from the user
$.getJSON(locationURL, function(data) {
longitude = data.lon;
latitude = data.lat;
var url = 'api.openweathermap.org/data/2.5/weather?lat=' + latitude + '&lon=' + longitude + '&appid=' + key;
console.log(url);
$.getJSON(url, function(data2){
console.log(data2, url);
});
});
});
But I get no return from the second JSON-call, and it seems like the variable 'url' is broken or something. What am I doing wrong or not seeing here?