Reputation: 31
I get the following error trying to declare
var directionsService = new google.maps.DirectionsService();
The error in my console
TypeError: Result of expression 'google.maps.DirectionsService' [undefined] is not a constructor.
Any ideas?
Upvotes: 1
Views: 3419
Reputation: 10147
You must add script reference to the <head>
of your page:
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
Upvotes: 3