Redraw table on submit form with ajax.
Redraw table on submit form with ajax.
Hello there.
Based od this example:
https://datatables.net/examples/server_side/row_details.html
I wrote custom editor for a datatable (without native editor extension), becouse I'm a newbie programmer, and I wanna learn something.
In first version, the form is sending "normally":
<form action="editor.php">
</form>
then editor.php making queries into mysql and do redirect back to the index.php.
Now. I wanna make some modernization, and I send form via ajax:
$('form').submit(function (e){
e.preventDefault();
$.ajax({
type: 'POST',
url: 'editor.php',
contentType: "charset=utf-8",
data: new FormData(this),
processData: false,
}).done(function(data){
alert( "Done" )
}).fail(function() {
alert( "Fail." );
});
return false;
})
Database updates correctly, but I have a problem: How can I do redraw datatable when the script is done?
Answers
Ok. I'm embarassed. It's simple like fking ;)