title: Append Geocode Result to Infowindow Content
body: <p>I want to ask how to append/display the geocode result into infowindow content. In this case, i have multiple marker. I try by using a div on infowindow content and update the div content after getting the geocode result (using callback), but it not works. How to solve this,,,</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Reverse Geocoding v3 Example&lt;/title&gt;
  &lt;script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?v=3&amp;amp;sensor=false"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="jquery-1.7.2.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="markerwithlabel.js"&gt;&lt;/script&gt;   
  &lt;script type="text/javascript"&gt;
      var locations = [
          {"name":"A","lat":"25.113787","lon":"-102.233276"}, {"name":"B","lat":"25.798243","lon":"-102.96936"}, {"name":"C","lat":"27.033032","lon":"-103.974609"}, {"name":"D","lat":"26.370545","lon":"-103.112183"},
          {"name":"E","lat":"26.636002","lon":"-100.794067"}, {"name":"F","lat":"25.699288","lon":"-98.827515"}, {"name":"G","lat":"24.805019","lon":"-100.332642"}, {"name":"H","lat":"24.285358","lon":"-101.705933"}
      ];
      var geocoder;
      var map;
      var marker;
      var lat_longs = new Array();
      var infoWindow = null;
      var markers = new Array();
      var poi = new Array();
      var fitMap = 0;
      var timer = null;
      totUpdateOld = new Array();
      streetLocation = new Array();
      ident = 0;
      function initialize() {
          geocoder = new google.maps.Geocoder();
          var latlng = new google.maps.LatLng(26.291773,-100.914917);
          var mapOptions = {
              zoom: 8,
              center: latlng,
              mapTypeId: google.maps.MapTypeId.ROADMAP
          }
          map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
          infoWindow = new google.maps.InfoWindow();
          updatetimer(function() {
              fitMapToBounds();
          });
      }       
      var updatetimer = function showCarPosition(){
          if (markers.length&gt;0){
              ident = 2;
          }
          for (var i = 0; i &lt; locations.length; i++) {
              var coordinate = new google.maps.LatLng(locations[i].lat, locations[i].lon);
              var windowContent =[
                    '&lt;div class="windowcontent"&gt;&lt;ul class="nav infowindow nav-pills nav-stacked"&gt;',
                      '&lt;li&gt;&lt;div id="pos'+i+'"&gt;&lt;/div&gt;&lt;li&gt;'].join('');
              if (ident == 0){
                  codeLatLng(function(addr, divid){
                      streetLocation.push(addr);
                      console.log(divid+'-'+addr);
                      $("#"+divid).html(addr);
                  }, coordinate, "pos"+i);
                  var marker = createMarker({
                      map: map,
                      position: coordinate,
                      labelContent: (locations[i].name),
                      labelAnchor: new google.maps.Point(32, 0),
                      labelClass: "unitlabel",
                      labelStyle: {opacity: 1.0}
                  });
                  bindInfoWindow(marker, 'click', windowContent);
                  google.maps.event.addListener(infoWindow, 'domready', function(){ 
                      $('.viewlog').click(function() {
                          $.history.load($(this).attr('href'));
                          return false;
                      });
                  });
              }
          }
          fitMapToBounds();
      };
  
      function codeLatLng(callback, coordinate, divid) {
          if (geocoder) {
              geocoder.geocode({'latLng': coordinate}, function(results, status) {
                  if (status == google.maps.GeocoderStatus.OK) {
                      if (results[1]) {
                          callback(results[1].formatted_address, divid);
                      }else {
                          callback("unknown", divid);
                      }
                  }else {
                      return "Geocoder failed due to: " + status;
                  }
              });
          }
      }       
      function createMarker(markerOptions) {
          var marker = new MarkerWithLabel(markerOptions);
          markers.push(marker);
          lat_longs.push(marker.getPosition());
          return marker;
      }
      function updateMarker(markerOptions,id) {
          var marker = new MarkerWithLabel(markerOptions);
          markers[id] = marker;
          lat_longs[id] = marker.getPosition();
          return marker;
      }       
      function fitMapToBounds() {
          var bounds = new google.maps.LatLngBounds();
          if (fitMap == 0){
              if (lat_longs.length&gt;0) {
                  for (var i=0; i&lt;lat_longs.length; i++) {
                      bounds.extend(lat_longs[i]);
                  }
                  map.fitBounds(bounds);
                  fitMap = 1;
              }
          }
      }
  
      function bindInfoWindow(marker, event, windowContent) {
          google.maps.event.addListener(marker, event, function() {
              infoWindow.setContent(windowContent);
              infoWindow.open(map, marker);
          });
      }       
      function loadScript() {
          var script = document.createElement("script");
          script.type = "text/javascript";
          script.src = "http://maps.googleapis.com/maps/api/js?key=AIzaSyDAT9KcSpQ7RNfg5iQHsivb4-72lNLanH0&amp;sensor=false&amp;callback=initialize";
          document.body.appendChild(script);
      }
  
      $(document).ready(function() {
          initialize();
      });
  
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="map_canvas" style="height:400px; border:1px 00f solid;"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>