[英]How to update google map circle through ajax in Gmaps4rails 1.5.6
在我的rails應用程序中,我使用1.5.6版本的gmaps4rails gem。 我想通過ajax更新我的地圖圈子屬性
任何人都可以建議我這樣做的程序嗎?
首先,得到你的圈子,應該在Gmaps.map.circles
然后:
circle.serviceObject.setRadius(number)
在ajax的成功函數中,您可以這樣編碼:
Gmaps.loadMaps()
// if you are using markers
markers_json = JSON.parse(markers)
Gmaps.map.replaceMarkers(markers_json)
// if you are using circle
Gmaps.map.clear_circles()
circle_json = JSON.parse(circle)
Gmaps.map.circles = circle_json
Gmaps.map.create_circles()
謝謝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.