Tuesday, May 21, 2024
 Popular · Latest · Hot · Upcoming
38
rated 0 times [  45] [ 7]  / answers: 1 / hits: 36371  / 13 Years ago, tue, december 20, 2011, 12:00:00

In my rails app I have a remote form that looks something like this for example:



<%= form_tag some_path, :method => :get, :id => 'my-form', :remote => true do %>
<%= text_field_tag :search, params[:search], :id => 'search-field' %>
<%= submit_tag 'Go' %>
<% end %>


Now i would like to submit this form via javascript and trigger all rails remote form callbacks. So far i have tried a few things but nothing seems to be working.



Things i have tried:



$('#my-form').trigger('onsubmit')

$.rails.callFormSubmitBindings( $('#search-form') )


but no luck so far. Any ideas?


More From » jquery

 Answers
10

You can just use .submit();



$(#my-form).submit();

[#88473] Sunday, December 18, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cierra

Total Points: 504
Total Questions: 108
Total Answers: 109

Location: Northern Mariana Islands
Member since Fri, Jan 15, 2021
3 Years ago
;