After submitting a remote form with Rails, how do I redirect the user to another page?

前端 未结 5 610
面向向阳花
面向向阳花 2021-02-10 17:47

I’m using Rails 4.2.3. I want to submit a form in a modal dialog, so I have set up my form like so

<%= form_for @my_object, :remote => true do |f| %>
         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-10 18:47

    redirect_to events_path, format: 'js'

    For this you will need to have events/index.js.erb in your file structure.

提交回复
热议问题