i am trying to get directions on a existing map. The documentation leaded me to this:
function getDirections()
{
console.log('get directions');
var map = $('#map');
map.gmap().bind('init', function(evt, m) {
map.gmap('displayDirections', { // error is here
'origin': 'Los Angeles, USA',
'destination': 'New York, USA',
'travelMode': google.maps.DirectionsTravelMode.DRIVING
}, {
'map': map
}, function(result, status) {
if ( status === 'OK' ) {
alert('Results found!');
}
});
});
}
but this doesn't seem to do anything. I get an error Uncaught Error: Invalid value for property <map>: [object Object]
.
my objective is to load a map and click a button to show some directions.
any ideas?
You need to pass a javascript element. Not a jquery element. Try