You need to have the places library loaded (it's an extra parameter to the normal call to google.maps.api library).
<script src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=visualization,drawing,places"></script>
Then create a PlacesService with:
var PlacesService = new google.maps.places.PlacesService(map);
There are many ways to search for places. In this example I'll search within my current map bounds
PlacesService.nearbySearch({
bounds: map.getBounds(),
//types: ['lawyer']
}, function(results, status, pagination) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
for(var i=0;i<results.length;i++) {
place=results[i];
var marker=new google.maps.Marker({position: place.geometry.location, icon:place.icon, map:map});
}
if (pagination.hasNextPage) {
// in case you get more markers to fetch
pagination.nextPage();
}
} else {
console.log(results, status);
}
});