Is there an "after submit" jQuery option? Is there an "after submit" jQuery option? javascript javascript

Is there an "after submit" jQuery option?


If you have no other handlers bound, you could do something like this:

$('#imageaddform').submit(function(e) {    e.preventDefault(); // don't submit multiple times    this.submit(); // use the native submit method of the form element    $('#imagefile').val(''); // blank the input});


Lonesomeday's solution worked for me but for Google Chrome I found it would still submit empty form data unless I added a timeout like this:

$('#imageaddform').submit(function(e) {    e.preventDefault(); // don't submit multiple times    this.submit(); // use the native submit method of the form element    setTimeout(function(){ // Delay for Chrome        $('#imagefile').val(''); // blank the input    }, 100);});


You could do something like this:

$('#imageaddform').submit(function(){  setTimeout(function() {    $('#imagefile').val('');  },100);});