I want to map a location, fill it's adress into an input field and add a marker.
Currently I have this, which works:
var home = new google.maps.LatLng(49.93547768118736, 11.2954580783844);
$('#map_canvas_1').gmap({'center': home, 'zoom':17 });
$('#map_canvas_1').gmap('addMarker', { 'position': home, 'animation' : google.maps.Animation.DROP } );
$('#map_canvas_1').gmap('search', { 'location': home }, function (results, status) {
$('#to').val(results[0].formatted_address);
});
What I'm wondering is why I cannot use a callback function to fill the input field like so:
$('#map_canvas_1').gmap({'center': home, 'zoom':17, 'callback': function() {
$('#map_canvas_1').gmap('search', { 'location': home }, function (results, status) {
$('#to').val(results[0].formatted_address);
});
} });
As a matter of fact, not even this works:
$('#map_canvas_1').gmap({'center': home, 'zoom':17, 'callback': function() {
alert ("callback");
} });
Can somebody tell me what I'm doing wrong?
There is no property 'callback'
in MapOptions, so you cannot set it.