const targetCountry = 'TR';
fetch('https://api64.ipify.org?format=json')
.then(response => response.json())
.then(data => {
const userIP = data.ip;
fetch(`https://ipinfo.io/${userIP}/country?token=`)
.then(response => response.text())
.then(country => {
const targetElement = document.querySelector("#test")
if (country === targetCountry) {
console.log('çalıştı');
} else {
console.error('hata');
}
});
})
.catch(error => {
console.error('IP alınırken bir hata oluştu:', error);
});Merhabalar. burda if şartım tutmasına rağmen (TR=TR) olmasına rağmen else çalışıyor. nedeni ne olabilir