I need to pass data from AJAX response. Here's the code:
function getLocation() {
$.get('https://ipinfo.io/json', function (data) {
console.log(data);
$('.test').html('<h2>Your location is: ' + data.city + '.</h2>');
});
}
getLocation();
It's working ok, but I want to use data.city
as variable, which I can pass to other api request, to get temperature for this city. I'm on the very begining of js/jQuery development, so any help would be appreciated.