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.
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 < 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);