title: Google Maps API - how to get latitude and longitude from Autocomplete without showing the map?
body: <p>I'm trying to get latitude and longitude from Autocomplete Google Maps API without showing the map. In my script autocompletion works well, but I can't get the latitude and longitude.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>    &lt;script type="text/javascript"&gt;
         function initialize() {
      
       var options = {
        types: ['(cities)']
       };
      
       var input = document.getElementById('searchTextField');
       var autocomplete = new google.maps.places.Autocomplete(input, options);
      }
         google.maps.event.addDomListener(window, 'load', initialize);
      
         var geocoder = new google.maps.Geocoder();
          var address = autocomplete;
      
      geocoder.geocode( { 'address': address}, function(results, status) {
      
        if (status == google.maps.GeocoderStatus.OK) {
          var latitude = results[0].geometry.location.lat();
          var longitude = results[0].geometry.location.lng();
          alert(latitude);
        } 
      }); 
      
      &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>