I'm trying to pass an url variable through the api fetch but I can't get any results back. Thanks, I am a bit of a newbie to Javascript.
//Get IP address
fetch('https://extreme-ip-lookup.com/json/')
.then((eip) => {
return eip.json();
}).then((eip) => {
document.getElementById('ip').value = eip.query;
var myip = document.getElementById('ip').value;
var url = "https://api.pray.zone/v2/times/today.json?ip=" + myip;
})
//Get City
fetch(url)
.then((res) => {
return res.json();
}).then((res) => {
document.getElementById('city').value = res.results.location.city;
})
I can get ip address but not city.