Closed ngelx closed 10 years ago
I'd need some other details, could you provide the full response sent by your server?
Hi @apneadiving thanks for your quick response and support for this awesome gem.
The response is:
$('#main-content').fadeOut(function() {
var $main = $(this);
var tpl = "<div id=\"map\" class=\"maps-google-fs\"><\/div>\n\n<script>\n $(\'#map\').height($(window).height() - $(\'#footer\').height() - $(\'.navbar.main\').height() - $(\'#menu-top\').height());\n\n<\/script>";
$main.html(tpl).fadeIn(function(){
var handler = Gmaps.build('Google', {markers:
{clusterer: {
gridSize: 100,
maxZoom: 12
}}});
handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){
markers = handler.addMarkers([{"picture":{"url":"/assets/3.png","width":12,"height":12},"marker_title":"cordoba 1200","lat":"-34.6624876","lng":"-58.6048213","infowindow":"<div> cordoba 1200</div>"},{"picture":{"url":"/assets/1.png","width":12,"height":12},"marker_title":"Ayala Gauna 7850","lat":"-32.9124234","lng":"-60.7318057","infowindow":"<div> Ayala Gauna 7850</div>"}]);
handler.bounds.extendWith(markers);
handler.fitMapToBounds();
});
});
history.pushState({url: '/maps/general'}, null, '/maps/general');
});
in contrast of the template generate by <% j render ... %> seems that infowindows has not the "/" character escaped, not sure if that is right.
I dont understand, are you sure the code is executed?
the js works fine: http://plnkr.co/edit/ox4AaEklUDyURA18X67t?p=preview
I'm sure that the code is not execute when i add the marker.infowindows param, but not sure why, or how to debug it.
add a debugger
in your file statement and open your js console
Not sure what was going on, but adding to the end of the controller's action these lines seems to fix it.
respond_to do |format|
format.js
format.html
end
Thanks for your help. Angel
+1 , having same issue and got it fixed with respond_to block. thanks guys
Hi, i'm having an issue with marker.infowindow and JS request.
Controller:
general.js.erb
_maps_fs_html.erb
_position_detail.html.erb
The thing is that when I make an AJAX request it simple do not work (no any error message at all ...)
but, if i comment the line of marker.infowindow, all works as expected.
Any help would be appreciated.
Thanks. Angel