I have added marker on google map with some search results.
var infowindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++) {
var contentString="";var image_path1="";
contentString += '<div class="browse-map-venue" style="padding:5px;width: 230px;">';
contentString += '<div class="rating" style="float: right; padding-right: 10px;">';
contentString += '<script type="text/javascript" src="<?php echo base_url(); ?>media/front/js/jquery.raty.min.js"><\/script>';
contentString += '<script>';
contentString += '$(function() {';
contentString += '$("#rating_fixed_rate_pop_'+ i +'").raty({';
contentString += 'readOnly: true,';
contentString += 'half: true,';
contentString += 'start: '+ locations[i][6] +',';
contentString += 'score: '+ locations[i][6] +',';
contentString += 'path: "<?php echo base_url(); ?>media/front/img"';
contentString += '});';
contentString += '});';
contentString += '<\/script> ';
contentString += '<div id="rating_fixed_rate_pop_'+ i +'"></div>';
contentString += '<a href="javascript:void(0);">'+ locations[i][7] +' reviews</a>';
contentString += '</div>';
contentString += '</div>';
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1],locations[i][2]),
title: locations[i][3],
info: contentString,
map: map
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(this.info);
infowindow.open(map, this);
});
}
But I need to add star rating with raty js which not getting applied to it when I click on marker.
Note: When we edit script written for rating from console and just after pressing enter it shows the stars. But I need those to be displayed when I click on marker in infowindow only.
Thanks in advance!
simple demo: