Google Places API-Typen, die Funktionalität..

<html>
    <head>
        <title></title>

        <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=places&sensor=true"></script>
        <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function () {
                var input = document.getElementById('location');
                var options = {                    
                    types: ["locality"]
                };

                autocomplete = new google.maps.places.Autocomplete(input, options);
            });
        </script>        
    </head>
    <body>
        <div>Location: <input type="text" id="location" style="width:400px;" /></div>               
    </body>
</html>

Dort ist mein code für die Erstellung meiner AutoVervollständigen-Position Texteingabe. Google ' s Liste der unterstützten Typen (http://code.google.com/apis/maps/documentation/places/supported_types.html) zeigt "Lokalität" als Typ zu verwenden, wenn ich nicht wollen, für alles, was kommen zurück in das Ergebnis(Unternehmen, etc.). Ich erhalte keine Ergebnisse.

Im Grunde, was ich erreichen möchte, ist die Suche nach einer Stadt (SPRICH: Toronto) Und sehen nur Ergebnisse wie: "Toronto, ON, Kanada". Vielleicht bin ich verwirrt, wie ich das implementieren diese API.

Vielen Dank für Ihre Antworten!

  • ich glaube nicht, dass Lokalität ist eine Art///
InformationsquelleAutor daveomania_x | 2011-11-18
Schreibe einen Kommentar