I want to load a map using gmaps4rails on-demand by loading html from the server into the current page without a full page load. I am essentially faking tabs using ajax like in pjax:
http://pjax.heroku.com/
This technique special links that triggers ajax calls to rails, that in turn returns a json rendering of a view. This json replaces a div target and it's subtree.
How can I load all the necessary elements to draw a map after the initial page load, when there are no other maps on the initial page, with gmaps4rails? The normal gmaps(..) or gmaps4rails(..) helper does not seem to work.
PS! There are other questions on stackoverflow about gmaps4rails and ajax calls, but none of them are tailored towards this kind of technique. A promising technique that I can not get working even on a normal page is this (I am running rails 3.1 with the asset pipeline): Rendering a Gmap through an AJAX call with Gmaps4rails
精彩评论