I'm trying to get the data with the for since there are several arrays but I can't get anything, the data I want to get is the city, the country, etc... what could I be doing wrong?
// CONSULTA
$.ajax({
url: "https://api.geocodify.com/v2/autocomplete?api_key=0000&q=" + this.value,
type: "GET",
success: function(location) {
for (var i = 0; i < location.length; i++) {
country.innerText = location[i].country;
}
}
});
DATA OBTAINED
Good afternoon, to obtain the country you should access as follows:
Fetch is native to javascript, you can call it with Ajax too.