Ich versuche also, Details basierend auf einer Google Places Textsuche zu erhalten. Meine Textsuche funktioniert gut, aber um Details zu erhalten, bekomme ich immer "Ungültige Anfrage".Google Places API erhält Details - Ungültige Anforderung
ich gefolgt sind Beispiele aus der Dokumentation, sowie Beispiele von anderen Menschen, aber ohne Erfolg, ich habe versagt ....
Dies ist meine Textsuche, die funktioniert.
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);
}
Dies ist Suche meinen Platz Details, die eine ungültige Anfrage Status dort
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);
}
);
}
Ich hatte die if (Status === google.maps.places.PlaceService.OK) erhält. Das ist also nicht das Problem, falls jemand das kapiert.
Jede Hilfe würde geschätzt werden ... Ich will, dass dies funktioniert!
Das war wirklich ein dummer Fehler. Das hat mich stundenlang in Foren gesucht. Danke vielmals. – Talha
Ich bin froh, dass ich helfen konnte, @Talha. – spiv
Ich habe versucht, 'PlaceResult.placeId' zu verwenden, aber das hat auch nicht funktioniert (ich habe stattdessen' undefined'), mit Places API V3 scheint es '' PlaceResult.place_id' 'genannt zu werden. – SidOfc