let xhr = new XMLHttpRequest();
xhr.open(
"GET",
"https://ip-geolocation.whoisxmlapi.com/api/v1?apiKey=at_ZVD4jknkwDhwTHDerhqDrmImBM1hQ&ipAddress"
);
xhr.send();
xhr.addEventListener("load", function() {
if (xhr.status != 200) {
alert(`Ошибка ${xhr.status}: ${xhr.statusText}`);
} else {
alert(xhr.response);
}
});