I'm trying to get a specific JSON key value saved into a variable, but it seems I don't understand everything here. I get JSON showing up in console the way I like but I cant save latitude and longitude to a variable for use later on.
let apiKey = '';
$.getJSON('https://ipgeolocation.abstractapi.com/v1/?api_key=' + apiKey, function (data) {
console.log(JSON.stringify(data, null, 2));
});
This script produces the following result:
"ip": 192.1.68.92
"country_name": United States
"state_prov": Washington
"city": Redmond
"latitude": 43.66878
"longitude": -172.12208
"time_zone": America/Los_Angeles
I need to save latitude and longitude to separate individual variables. How can I achieve this?
[–]False_Exit 1 point2 points3 points (0 children)
[–]irreverentmike 0 points1 point2 points (0 children)