mercredi 25 février 2015

Why won't this Rails form won't submit via JavaScript?

I am attempted to submit a basic Rails form via JavaScript but it's just not working... I have no idea why. I have set remote to true and have checked that all appropriate files are loaded. Can anyone help?


Here is my form code.. I am using the Ransack search_form_for helper, but I don't think this should have any impact.



<%= search_form_for @q, url: (form_url), id: 'my-form', remote: true, html: {method: :get, :class => 'filter-form'} do |f| %>


Here is my jQuery:



jQuery ->
$('#my-form').submit();


Have I missed something super obvious here?


Here is the the form tag it's rendering:



<form accept-charset="UTF-8" action="/products" class="filter-form" data-remote="true" id="my-form" method="get">

Aucun commentaire:

Enregistrer un commentaire