【发布时间】:2010-03-01 19:24:08
【问题描述】:
我正在尝试使用 YM4R/GM 将 Google 地图添加到我的页面。作为使用form_tag 的常规提交,一切正常,所以我知道我没有搞砸那部分。
但是使用 form_remote_tag 我最终在我的更新 div 中什么都没有。我使用渲染文本进行了测试,因此正在执行正确的方法,并且 YM4R/GM 正在返回 Google Maps KML。但是地图没有显示出来。
我的表单标签:
<% form_remote_tag(:url => {:controller => "home", :action => "search"}, :update => "map_div") do %>
指定为表单操作的搜索方法:
def search
location = GeoKit::Geocoders::MultiGeocoder.geocode(params[:address])
@map = GMap.new("map_div")
@map.control_init(:large_map => true,:map_type => true)
@map.center_zoom_init([location.lat,location.lng],11)
render :partial => 'map'
end
将要更新的 div 放在部分内部,然后渲染该部分是否正确?
我是不是把这件事复杂化了,还是走错了路?当我看到 Google 的 KML 输出时,我知道正在执行 YM4R/GM 代码。我想知道问题是否与 XML/KML 响应有关? Rails 是否将响应解释为 XML 而不是 HTML?
【问题讨论】:
标签: ruby-on-rails ruby ajax google-maps