I am trying to populate a list of cities and also mark them on the maps, Using AJAX I am updating a div element with the list of cities and for each city element I am trying to call the addmarker() function which is supposed to add a marker on top of google maps. using firebug I can see a javascript tag with the function call, but the addmarker() is not being executed
What is the best approach to forcibly call the javascript function and also update the dom element ?
here is how my addmarker() looks like:
function addmarker(lat,lng,title_new)
{
new_marker = new google.maps.Marker({
position: latlng_new,
map: map,
title:title
});
}
Here is how my html.erb file looks like
<%= post.content %>
<script type="javascript"> addmarker( <%= post.lat_long%>, <%= post.title%>);
</script>
</div>
The DOM element is being updated after document has finished loading.