Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Maps infoWindow only loading last record on markers
    primarykey
    data
    text
    <p>I'm trying to load a google map with dynamic markers and dynamic infoWindows to go with them. Basically I've got the markers working. The infoWindows are clickable and closable, however they do not have the correct content. It seems that the content for every infoWindow is the last record that is found in the query loop. You will see whats happening <a href="http://prosperityeasterniowa.org/bsc/new/testmap.cfm" rel="noreferrer">here</a> Here's the code:</p> <pre><code>&lt;script type="text/javascript"&gt; //Load the Google Map with Options// function initialize() { var myLatlng = new google.maps.LatLng(42.48019996901214, -90.670166015625); var myOptions = { zoom: 6, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); //Begin query loop to set the markers and infoWindow content// &lt;cfoutput query="GetCoord"&gt; var LatLng = new google.maps.LatLng(#Client_Lat#, #Client_Lng#); var marker = new google.maps.Marker({ position: LatLng, map: map, title: "#Client_Company#" }); var contentString = '&lt;p&gt;&lt;b&gt;#Client_Company#&lt;/b&gt;&lt;br&gt;'+ '#Client_Address#&lt;br&gt;'+ '#Client_City#,&amp;nbsp; #Client_State# &amp;nbsp; #Client_Zip#&lt;br&gt;'+ '&lt;a href="member_detail.cfm?ID=#Client_ID#"&gt;View Details&lt;/a&gt;'; var infowindow = new google.maps.InfoWindow({ content: contentString }); google.maps.event.addListener(marker, 'click', function() { infowindow.open(map,this); }); &lt;/cfoutput&gt; //End query loop } &lt;/script&gt; </code></pre> <p>Any ideas on why this is happening?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload