How to write "on form submit complete" using javascript?
forms, html, javascript, jquery
Solution
Actually, you can use the jquery form plugin, just use the ajaxSubmit() method.
Documentation for the jQuery form plugin.
// setup the form, and handle the success
$('#myFormId').ajaxForm({
success: function() {
// do what you are looking to do on
// success HERE
}
});
// setup submission on some random button
$('#someButton').click(function() {
// submit the form from a button
$('#myFormId').ajaxSubmit();
});
Problem
I have a form loading inside my page and there is a button out side this form its function is to submit this form. ``` $('#MyForm').submit(); ``` I want a way to write a submit complete function, means to know that the form successfully/completely submitted. I tried the jquery form plugin, but didn't work, i think because the submit come from a button outside the form. anyone knows any different ways?