Let me explain the whole stream of AJAX-Rails and remote=> true .
First, when you add remote => true to the form, it submits or invokes the action that you defined on the form.
Here is an example:
<%= form_tag({:controller => 'my', :action => 'my_data'},:id => 'filter_form', :remote => true) do %>
Now the above code will go to the my_data action in my controller.
Here you can determine the type of response:
def my_data
Now you need to create the " .js " file with the same name as the action:
my_data.js.erb
This " .js " file will handle the form. You can write and update document elements through jQuery and JavaScript.
Bharat soni
source share