MOGSY Posted April 11, 2018 Share Posted April 11, 2018 Hi I am trying to do an address search, I am using the following JS code, however, I get the error "can't read property "places" undefined. I would much appreciate your help. UniSession.AddJS('var gm = googleMap; '+ 'if (typeof gm == "object") '+ '{ '+ ' var imagecar = "car.png"; '+ ' var searchBox = new gm.maps.places.SearchBox("219 Leicester Road, Marlfield, LE67 9RF"); '+ ' var places = searchBox.getPlaces(); '+ ' if (places.length != 0) '+ ' { '+ ' places.forEach '+ ' ( '+ ' function(place) '+ ' { '+ ' markers.push '+ ' ( '+ ' new google.maps.Marker '+ ' ( '+ ' { '+ ' map: gm, '+ ' icon: imagecar, '+ ' title: place.name, '+ ' position: place.geometry.location '+ ' } '+ ' ) '+ ' ) '+ ' } '+ ' ); '+ ' } '+ '} ' ); error_message.html Link to comment Share on other sites More sharing options...
Sherzod Posted April 11, 2018 Share Posted April 11, 2018 Hi, Can you make a simple testcase if possible?! Best regards, Link to comment Share on other sites More sharing options...
Recommended Posts