javascript - Google Places API get details - Invalid Request -


so i'm trying details based on google places text search. text search working fine, details keep getting "invalid request".

i've followed examples documentation, examples other people no avail, have failed....

this text search, working.

var lat = '43.09182244507046' var lng = '-89.48985488807972' var places;     function initialize() {           var location = new google.maps.latlng(lat,lng);          var map = new google.maps.map(document.getelementbyid('map'),{             center: location,             zoom: 15         });          var request = {             location: location,             radius: '50000',             query: 'food'         };          var callback = function (results, status) {                 places = results;               console.log(status);               console.log(places);         }          var service = new google.maps.places.placesservice(map);         service.textsearch(request, callback);      } 

this place details search getting invalid request status

var place_details;         function getdetails() {              var location = new google.maps.latlng(lat,lng);              var map = new google.maps.map(document.getelementbyid('map'),{                 center: location,                 zoom: 15             });              var callback = function (results, status) {                 place_details = results;             };              var service = new google.maps.places.placesservice(map);             service.getdetails({                 placeid: "8deae188679ff8b9344085de5360a769879240f9"}, function(place, status){                    place_details = place;                     console.log(place_details);                     console.log(status);                 }             );         } 

i had if(status === google.maps.places.placeservice.ok) in there. that's not issue in case catches that.

any appreciated... want work!

8deae188679ff8b9344085de5360a769879240f9 not place id. suspect you're using placeresult.id doesn't work details requests , deprecated.

instead use placeresult.placeid. see the documentation details , examples.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -