I am attempting to obtain the address components using the Google Maps API however am unable to properly parse results. My code is as follows:
// Ajax Call
$.ajax({
url: 'queryPage.php?',
data: 'varObtainGoogleAddress=y&' +
'varAPILink=' + encodeURIComponent(varAPILink),
dataType: 'json',
success: function(data) {
// Formatted Address
varFormattedAddress = data.result['formatted_address']; // Works!
}
});
What I would like is the city, state and postal code items. Any help in this regard is appreciated. I am a self taught amateur web developer. :)