I have a rails form that updates a devise user. I want to submit the form silently because it's part of a wizard the user is going though. Even with remote: true
on the form, triggering a submit action with javascript causes the page to reload. Here is some code:
<%= form_for(@current_user, as: resource_name, url: registration_path(resource_name), html: { method: :put }, remote: true) do |f| %>
and the javascript is:
btnContinue.addEventListener("click", (e) => {
$("#edit_user").submit()
});
I've tried:
$("#edit_user").submit(function (e) {
e.preventDefault();
});
But that doesn't trigger anything.
All I'm trying to do here is submit the form in the background while I send the user to the next step on the same page. Any ideas what I'm missing here?