I'm trying to natively submit a form using the code below:
$('#invoices-bundle').submit(function(e) {
e.preventDefault(); // don't submit multiple times
this.submit();
$.post('php/seller/invoice/invoice_print_batch.php', function(data){
$('#added-invoices').html(data);
});// use the native submit method of the form element
});
After the submit(); I want to populate the DOM with the contents of my PHP script. The weird thins is the DOM doesn't get populated the first time I submit the form but the second time and everytime after that.
Don't know why this happens! Any suggestions?
Thanks!