I have a problem with the Google Maps API and its PlacesService. Despite the fact that I loaded the place library correctly, it says: "It is not possible to read the" PlacesService "property from undefined." The card itself works and loads. Any ideas? Here is the code:
<div id="map-canvas"></div> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3&libraries=placeβs"></script> <script type="text/javascript"> var myLatlng; var map; var marker; function initialize() { myLatlng = new google.maps.LatLng(fooLat, fooLng); var mapOptions = { zoom: 17, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP, scrollwheel: false, draggable: true }; map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); var service = new google.maps.places.PlacesService(map); var request = { placeId: 'fooPlaceId'}; service.getDetails(request, callback); function callback (place, status) { if (status == google.maps.places.PlacesServiceStatus.OK) { marker = new google.maps.Marker({ position: place.position, map: map, title: place.name }); } }; } google.maps.event.addDomListener(window, 'load', initialize); </script>
Update: I literally just tried a piece of code from Google itself , and it gave me the same error.
javascript google-maps google-maps-api-3 google-places-api
m_highlanderish
source share