title: google map api nearby place search
body: <p>I am using the Google Maps API places library to use the nearby search feature in my Worklight application but  only the map is displayed and the nearby places is not shown.Please help me with this.Here is my java script code.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var map;
  var infowindow;
  
  function initialize() {
    var latlon = new google.maps.LatLng(25.984602, 90.785091);
    mapCanvas = document.getElementById('mapholder');
    mapCanvas.style.height = '250px';
    mapCanvas.style.width = '500px';
  
    map = new google.maps.Map(document.getElementById('mapholder'), { mapTypeId: google.maps.MapTypeId.ROADMAP,
      center: latlon,
      zoom: 15
    });
  
    var currentMarker = new google.maps.Marker({
       map: map,
       position: latlon,
       title:'Current Location'
     });
    
    var request = {
      location: latlon,
      radius: 500,
      types: ['atm']
    };
    infowindow = new google.maps.InfoWindow();
    var service = new google.maps.places.PlacesService(map);
    service.nearbySearch(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]);
      }
    }
    else
     alert("Status not OK");
  }
  
  function createMarker(place) {
   alert("createMarker function");
    var placeLoc = place.geometry.location;
    var marker = new google.maps.Marker({
      map: map,
      position:  place.geometry.location
    });
  
    google.maps.event.addListener(marker, 'click', function() {
      infowindow.setContent(place.name);
      infowindow.open(map, this);
    });
  }
  
  google.maps.event.addDomListener(window, 'load', initialize);</code></pre>
  </div>
  </div>
  </p>