$('#form').submit(function(e){
e.preventDefault();
$.ajax({
//ajax stuff
success: functtion(data){
//do stuff with data, then submit form
$('#form').submit(); // <-- this wont submit the form
}
});
});
How can I submit this form after my ajax call is complete?
you have a typo here: functtion
then try in this way, creating a reference to the form itself, using native submit() method available for form element
$('#form').submit(function(e){
e.preventDefault();
var form = this;
$.ajax({
//ajax stuff
success: function(data){
...
form.submit();
}
});
});
Use the native submit method:
document.getElementById("form").submit();
// with jQuery:
$("#form")[0].submit();
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