开发者

drawing a map with gmaps4rails *after* the initial page load

开发者 https://www.devze.com 2023-04-02 11:28 出处:网络
开发者_高级运维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:
开发者_高级运维

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

0

精彩评论

暂无评论...
验证码 换一张
取 消