title: Google Map API v3 InfoWindow won't open with setContent from a function
body: <p>I have a simple Google map v3 code.  It creates the map and adds a marker to the markerCluster.  It is all working fine, except for setting content to the infoWindow and opening it.
  The function <code>getSupplierDetails()</code> simply returns a short string (i.e. "Red Supply").</p>
  
  <p>Here is the problem:  If I hard code the text "Red Supply" to the setContent line like <code>infoWindow.setContent("Red Supply");</code> then the infowindow open fine with the content.</p>
  
  <p>But if I leave it as it is as in the code below the infowindow does not open at all, although the <code>getSupplierDetails()</code> function returns "Red Supply".</p>
  
  <p><code>getSupplierDetails()</code> function returns this JSON string:  <code>{"popupContent": "Red Suppplier"}</code> from Firebug.</p>
  
  <p>Spent so long on it without any solution.  Any help appreciated.</p>
  
  <p>Thanks</p>
  
  <pre><code>var map;
  var markerCluster;
  var infoWindow;
  
  $(document).ready(function() {
  
    if (mapElem != null) {
          var latlng = new google.maps.LatLng(54.664936, -2.706299);
          var myOptions = {
              zoom: 5,
              center: latlng,
              mapTypeId: google.maps.MapTypeId.ROADMAP,
          };
  
          map = new google.maps.Map(mapElem, myOptions);
          markerCluster = new MarkerClusterer(map);
          infoWindow = new google.maps.InfoWindow();
  
      AddMarkers();
    }
  });
  
  function AddMarkers(){
      markerCluster.clearMarkers();
      var marker = new google.maps.marker({position:latLng, map:map, title:"title"});
  
      google.maps.event.addListener(marker, 'click', function() {
        var res = getSupplierDetails();
        infoWindow.setContent(res);
        infoWindow.open(map, this);
      });
  
      markers.push(marker);
      markerCluster.addMarkers(markers);
  }
  
  
  function getSupplierDetails() { //returns {"popupContent": "Red Suppplier"}
      $.ajax({
          type: 'POST',
          url: "sitedetail.aspx",
          dataType: 'json',
          timeout: 30000,
          success: function(data) {
              return data.popupContent;
          },
          error: function(xhr, textStatus, thrownError) {
              var resp = JSON.parse(xhr.responseText);
              alert(resp.message);
  
          }
      });
  }
  </code></pre>