I have a simple form with remote=true.
This form is actually on an HTML Dialog, which gets closed as soon as the Submit button is clicked.
Now I need to make some changes on the main HTML page after the form gets submitted successfully.
I tried this using jQuery. But this doesn't ensure that the tasks get performed after some form of response of the form submission.
$("#myform").submit(function(event) {
// do the task here ..
});
How do I attach a callback, so that my code gets executed only after the form is successfully submitted? Is there any way to add some .success or .complete callback to the form?
I just did this -
$("#myform").bind('ajax:complete', function() {
// tasks to do
});
And things worked perfectly .
See this api documentation for more specific details.