views:

16

answers:

0

Not sure what framework (if any) Google Maps v3 is built on top of but I'm having issues trying to access global variables within the following function.

var geocoder = new google.maps.Geocoder();
geocoder.geocode({
   'address': google_addresses_array[i][1]
}, function(results, status) {
   if (status == google.maps.GeocoderStatus.OK) {
      alert(i);  // I cannot reference i from here
   }
});

I tested the status and it's returning the correct latitude and longitude etc.