I have a form that I want to submit through AJAX most of the time. However, there's also multiple file fields in the form. Whenever a file is submitted I need to temporarily disable AJAX-functionality so that the file can be processed.
I tried removing the data-remote attribute, but of course that's not enough because jQuery already binds the AJAX function to the form. How do I unbind it?
Edit:
Oh wow, I'm so stupid. Rails does this by default. I hadn't even tried it yet. Sorry for polluting StackExchange.
Why don't you simply remove the data-remote attribute. If you are using jquery it would look something like this:
$("#element").removeAttr("data-remote");
You can use :disable_with option like
<%= submit_tag 'Submit', :disable_with => 'Please wait..' %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With