title: Convert latitude, longitude in to address as a string
body: <p>Please help me resolve this problem.<br>
  I want to get address from latitude, longitude in Google Maps.
  Here is my functions:  </p>
  
  <pre><code>function codeLatLng() {
  var geocoder = new google.maps.Geocoder();
  var lati = document.getElementById("latitude_value").value;
  var lngi = document.getElementById("longitude_value").value;
  var latlng = new google.maps.LatLng(lati, lngi);
  var infowindow = new google.maps.InfoWindow();
  var ngo;
  geocoder.geocode({'latLng': latlng}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
      if (results[1]) {
        map.setZoom(11);
        marker = new google.maps.Marker({
          position: latlng,
          map: map
        });
        ngo = results[1].formatted_address;
        infowindow.setContent(results[1].formatted_address);
        infowindow.open(map, marker);
      }
    } else {
      alert("Geocoder failed due to: " + status);
    }
  });
  return ngo;
   }
  </code></pre>
  
  <p>When this function is executed. The address is displayed in Maps.<br>
  <strong>However, this is not what I need. I just want to assign this address to variable 'ngo' as a string.</strong><br>
  This function return 'ngo' which is displayed in the text field as 'undefinded'.<br>
  I need some help to solved this problem.<br>
  Thanks.</p>