从控制器获取标记以使用 gmaps4rails 刷新地图
我有一个使用 gmaps4rails 在 Rails3 应用程序中具有多个标记的应用程序。
地图最初加载了所有标记,但我在页面上有一个过滤器字段,我希望用户过滤存储在数据库中的标记的不同内容。
如何触发地图以使用参数调用控制器,该参数将返回一个新的 json 对象,然后将其放入 Gmaps4Rails.replaceMarkers 函数中?
我正在使用 JQuery,因此最好从 Jquery 代码触发此行为。
问候, 约翰
I have an app with multiple marker in a Rails3 application using gmaps4rails.
The map is loaded initially with all the markers but I have a filter fields on the page which I would like the user to filter different things which are stored in the db for the markers.
How to I trigger the map to call the controller with the parameters which would return a new json object, which I would then put in Gmaps4Rails.replaceMarkers function?
I'm using JQuery so it would probably be best to trigger this behavior from Jquery code.
Regards,
Johann
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不为这些过滤器字段(或在提交按钮中)设置一个事件侦听器,然后通过 AJAX 在服务器上调用 your_controller ?
未测试代码。
Why don't you just set a event listener to those filter fields (or in a submit button), that then calls your_controller at the server via AJAX?
Didn't test the code.