title: Google geocode is late (still one step behind)
body: <p>I put there my whole code. Trying to determine location address. My script should create still one marker with geocoded address (in console - variable kktina).</p>
  
  <p>But, unfortunately, there isn't everything OK. Because by script still resolves previous location (or it takes previous coordinates, dunno). Maybe there is an error in code, but I'm not able to do this anymore.. </p>
  
  <p>So asking for help, thank you! </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Google Maps JavaScript API v3 Example: Map Simple&lt;/title&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;style&gt;
    html, body, #map_canvas {
      margin: 0;
      padding: 0;
      height: 100%;
    }
    &lt;/style&gt;
    &lt;link rel="stylesheet" type="text/css" href="style.css"&gt;
    &lt;script src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;sensor=false&amp;libraries=places,geometry"&gt;&lt;/script&gt;
    &lt;script src="http://code.jquery.com/jquery-1.7.min.js" type="text/javascript"&gt;&lt;/script&gt;
    &lt;script&gt;
    var map,marker;
    var geocoder = new google.maps.Geocoder();
    var markers = [];
    var img,icon,type;
    var prenos,pos,address = "5",point;
  
  
        function clearMarkersFromArray() {
      if (markers.length&gt;0){
        markers[0].setMap(null);
        markers.shift(markers[0]);
      }
    }
  
    function geocodePosition(pos) {
      geocoder.geocode({
        latLng: pos
      }, function(responses) {
        if (responses &amp;&amp; responses.length &gt; 0) {
          address = responses[0].formatted_address;
        } else {
          address = 'Cannot determine address at this location.';
        }
      });
      return address;
    }
  
    function initialize() {
  
      var mapOptions = {
        zoom: 7,
        center: new google.maps.LatLng(49,19),
        mapTypeId: google.maps.MapTypeId.ROADMAP
      };
  
      map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions),
  
      google.maps.event.addListener(map, 'click', function(response) {
        clearMarkersFromArray();
        point = new google.maps.LatLng(response.latLng.$a,response.latLng.ab); 
        var kktina = geocodePosition(point);
        console.log(kktina);
        var marker = new google.maps.Marker({
          position: point,
          draggable: true
        });
        markers.push(marker)
        marker.setMap(map);
  });
  }
  google.maps.event.addDomListener(window, 'load', initialize);
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div id="map_canvas" style="height:400px;width:700px;"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>