Me gustaría obtener las sugerencias de Google mediante programación (sin menú desplegable). Este es mi código:
<!DOCTYPE html> <html> <body> <script> function initService() { var displaySuggestions = function(predictions, status) { if (status != google.maps.places.PlacesServiceStatus.OK) { console.log(status); return; } predictions.forEach(function(prediction) { console.log(prediction) }); }; var service = new google.maps.places.AutocompleteService(); service.getQueryPredictions({ input: 'Musterstraße 3' }, displaySuggestions ); } </script> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=&libraries=places&callback=initService" async defer></script> </body> </html>Recibo la sugerencia a través de console.log Todos los valores están disponibles. Solo falta el código postal. ¿Dónde está mi error?