// Ref: https://medium.com/@ipapi/ip-address-location-javascript-examples-82dd5d6da9cb
fetch('https://ipapi.co/json/')
.then(function(response) {
return response.json();
})
.then(function(data) {
console.log(data);
});
/* Response Data:
----------
ip: "182.185.198.178",
city: "Lahore",
region: "Punjab",
region_code: "PB",
country: "PK",
country_code: "PK",
country_code_iso3: "PAK",
country_capital: "Islamabad",
country_tld: ".pk",
country_name: "Pakistan",
continent_code: "AS",
in_eu: false,
postal: "54000",
latitude: 31.4909,
longitude: 74.3681,
timezone: "Asia/Karachi",
utc_offset: "+0500",
country_calling_code: "+92",
currency: "PKR",
currency_name: "Rupee",
languages: "ur-PK,en-PK,pa,sd,ps,brh",
country_area: 803940,
country_population: 184404791,
asn: "AS45595",
org: "Pakistan Telecom Company Limited"
---------- */