开发者

Rails 3 form_tag opens javascript in a new page instead of loading it in the current page

View:

form_tag(url_for(:controller => :matchers,
                :action => :show_matched_alarms_list),
        :remote => true,
        :method =>:get,             
        :class => "matcher_ajax_form") do |f|

Controller:

layout 'application',:except=>[:show_matched_alarms_list]
def show_matched_alarms_list
  @matcher= ...
  render :update do |page|
    page.replace('matched_alarms_list',
                 :partial => 'matchers/matched_alarms_list',
                 :locals=>{:matcher=>@matcher})
  end
end

This is opening the Returned Javascript in a new page instead of load开发者_如何学Cing it in the opened page. Does anyone know how to fix this?

I am using prototype. The form looks like this:

<form accept-charset="UTF-8" 
      action="/matchers/show_matched_alarms_list" 
      class="matcher_ajax_form" 
      data-remote="true" 
      method="get">


I have fixed this.

The problem was that I submiting the form using the form.submit() method, which apparently doesn not work fine when using a remote form. I replaced it for the form.request() method and it worked as expected.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜