title: Initialize Google map on AJAX refreshed partial
body: <p>I can display a google map with markers no problem but I can't get a map to display within a partial when that partial is refreshed using ajax. I'm guessing it's because this final initialization line at the end isn't fired when using ajax:</p>
  
  <pre><code>function initialize() {
  var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
  var mapOptions = {
  zoom: 4,
  center: myLatlng,
  mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
  
  var marker = new google.maps.Marker({
    position: myLatlng,
    map: map,
    title: 'Hello World!'
  });
  }
  
  google.maps.event.addDomListener(window, 'load', initialize);
  </code></pre>
  
  <p>So can I initialize the map by using one of the ajax success handlers? I've tried this with no luck but the syntax is probably wrong and I don't know where to put this:</p>
  
  <pre><code>$(document).ajaxSuccess(function() {
      google.maps.event.initialize;
  });
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>EDIT:</p>
  
  <p>I'm loading the partial _property_details.html.erb in the <code>#response</code> div of the properties/index.html.erb page by adding <code>remote =&gt; true</code> to the links and this is the show.js.erb code:</p>
  
  <p><code>properties/show.js.erb</code></p>
  
  <p><code>$("#response").html("&lt;%= escape_javascript(render('property_details')) %&gt;");</code></p>
  
  <p>The Google code is all at the bottom of the <code>properties/index.html.erb</code> page in a script tag. </p>