Pracuję z Google Maps API v3 na adresy geokodowe. Jak przekazać dodatkowe informacje do funkcji geocodeCallBack? Zobacz mój kod & komentarze poniżej, aby zrozumieć, co próbuję osiągnąć.Google Maps API v3 - Przekaż więcej informacji do GeoCode Oddzwonić?
var address = new Array();
address[0] = {name:'Building 1',address:'1 Smith Street'};
address[1] = {name:'Building 2',address:'2 Smith Street'};
for(var rownum=0; rownum<=address.length; rownum++)
{
if(address[rownum])
geocoder.geocode({'address': address[rownum].address}, geocodeCallBack);
}
function geocodeCallBack(results, status)
{
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
//how can I also add the name of the building to the title attribute?
title: results[0].formatted_address
});
}
jak tutaj zamknięcie zastąpi funkcję geokodowania? Jestem zdezorientowany, jak to działa –