Camarades,

I'm having trouble getting the position of an address. However, this
problem occurs only the first time that I run, ie it is necessary that
every time I make the query, I click twice, for only the second values
are obtained.

I believe the problem is due to be asynchronous method. But I am not
able to solve the problem. Some of his friends could help me.

Code:

$('#btnTracar').click(function(){
        if (geocoder){
                geocoder.geocode({ 'address':
document.getElementById('txtStart').value }, function(results, status)
{
                        if (status == google.maps.GeocoderStatus.OK) {
                                mapStart = results[0].geometry.location;
                        } else { alert("Não foi possível carregar a localização.
\nDescrição do Erro: " + status); }
                });

                geocoder.geocode({ 'address':
document.getElementById('txtEnd').value }, function(results, status){
                        if (status == google.maps.GeocoderStatus.OK) {
                                mapEnd = results[0].geometry.location;
                        } else { alert("Não foi possível carregar a localização.
\nDescrição do Erro: " + status); }
                });

                calcularRota();
        }
});

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to