title: How to find place details using nearby search in Google places api?
body: <p>I cannot get the place details to display when each place icon is clicked. I read the documentation and thought I coded it correctly. Anyone have any suggestions? It is also not giving me all of the results that I should get. It only outputs 1 nearby hotel when there are really about 30. Thanks.      </p>
  
  <pre><code>  var map;
    var infowindow;
    function initMap() {
      var messiah = {lat: 40.158350, lng: -76.987454};
      map = new google.maps.Map(document.getElementById('map'), {
        center: messiah,
        zoom: 12
      });
  
      var marker = new google.maps.Marker({
          position: messiah,
          map: map,
          title: 'Messiah College'
      });
  
      var request = {
          location: messiah,
          radius: 10000,
          type: ['lodging']
      }
      infowindow = new google.maps.InfoWindow();
      var service = new google.maps.places.PlacesService(map);
      service.nearbySearch(request, callback);
      service.getDetails(request, callback);
    }
  
    function callback(results, status) {
      if (status === google.maps.places.PlacesServiceStatus.OK) {
          for (var i = 0; i &lt; results.length; i++) {
              createMarker(results[i]);
          }
       }
    }
  
    function createMarker(place) {
      var placeLoc = place.geometry.location;
      var marker = new google.maps.Marker({
          map: map,
          icon: {
              url: 'http://maps.gstatic.com/mapfiles/circle.png',
              anchor: new google.maps.Point(10, 10),
              scaledSize: new google.maps.Size(10, 17)
          },
          position: place.geometry.location
    });
  
  
    var request = { reference: place.place_id };
    service.getDetails(request, function(details, status) {
      google.maps.event.addListener(marker, 'click', function() {
          infowindow.setContent(details.name + "&lt;br /&gt;" + details.                              formatted_address +"&lt;br /&gt;" + details.website + "&lt;br /&gt;" +                      details.rating + "&lt;br /&gt;" + details.formatted_phone_number);
          infowindow.open(map, this);
    });
  }); 
  </code></pre>
  
  <p>}</p>