I'm doing a job for college, and I'm having a hard time getting a certain return from the Google Maps API.
I want to access some information on the return for example:
- formatted_address
- long_name
- address_components
And other data, my biggest question is how I'll access this data, I've already tried to make a foreach according to the API link: link
But I did not get results, I do not have much experience with Jquery so I'm asking for help.
My code:
$(document).ready(function(){
$.get( "https://maps.googleapis.com/maps/api/geocode/json?latlng=-18.7349526,-47.5007307&key=AIzaSyDWGoaR3axvFCAWuux-nZyW4ms39anWj_w", function(data) {
console.log(data);
var myAddress;
var myJSONResult = data;
for (i = 0; i < data.results.length; i++) {
myAddress[i] = data.results[i].formatted_address;
}
});
});