I am trying to submit a form with jQuery if any of the element changes. For now I am not using remote: true
.
Here is the code that renders the partial:
views/assets/index.html.erb
<%= render @assets %>
Code for partial:
views/assets/_asset.html.erb
<%= form_for [asset.project, asset] do |f| %>
...
<% end %>
Following is the javascript code for form submit:
$(document).on('turbolinks:load', function() {
if (!($(".assets.index").length > 0)) return;
$('.edit_asset').change(function() {
alert("submitting..");
$(this).submit();
});
});
It's doing the alert
but form is not getting submitted, please suggest..