title: Function to get Longitude and Latitude from Location using Javascript
body: <p>My function is like this.</p>
  
  <pre><code>function getLatLong(address){
      var latitude="";
      var geocoder =  new google.maps.Geocoder();
  
      geocoder.geocode( { 'address': address}, function(results, status) {
          latitude = results[0].geometry.location.lat();
          alert(latitude);
  });
     return latitude;
  }
  
  
    alert(getLatLong(co));
  </code></pre>
  
  <p>when i call this function I get empty result but the alert in the function returns the latitude.what the problem?</p>