this is my code
function show(placelanlat,names)
{
var placenames=names;
var planlat=placelanlat;
var newStr= planlat.replace(/[(\)]/g,'');
var aCars = newStr.split(',');
var infowindow = new google.maps.InfoWindow();
var marker;
var geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(12.588,-83.667);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvass"), myOptions);
var input = newStr;
var latlngStr = input.split(",",2);
var lat = parseFloat(latlngStr[0]);
var lng = parseFloat(latlngStr[1]);
var latlng = new google.maps.LatLng(lat, lng);
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
map.setZoom(11);
marker = new google.maps.Marker({
position: latlng,
map: map,
icon: 'images/images.png'
});
infowindow.setContent(placenames+"</br>"+results[0].formatted_address+"</br>");
infowindow.open(map, marker);
}
}
else {
alert("Geocoder failed due to: " + status);
}
});
return false; // MANDATORY!
}
if i set
infowindow.setContent(placenames+"</br>"
+results[0].formatted_address
+"</br>"+results[0].formatted_phone);
results[0].formatted_phone ->
this is showing empty.why?
where i want to change to get place phone number.
example:http://www.google.com/maps?source=uds&daddr=India,++%28India%29+@20.593684,78.96288&saddr=37.781287,-122.395575
if you use
The Google Places API (Experimental)then follow these steps
now use Place Search Requests
A Place Search request is an HTTP URL of the following form:
https://maps.googleapis.com/maps/api/place/search/output?parameters
Certain parameters are required to initiate a Place Search request
Each result within the results array may contain
Once you have a
referencefrom a Place Search request, you can request more details about a particular establishment or point of interest by initiating a Place Details request.A Place Details request returns more comprehensive information about the indicated place such as its complete address, phone number, user rating, etc.
A Place Details request is an HTTP URL of the following form:
https://maps.googleapis.com/maps/api/place/details/output?parameters
Certain parameters are required to initiate a search request.
output of Place Details contains
formatted_phone_numberandinternational_phone_number.Hope it would helps u.