how i can reload datatables into multiple functions ajax response when datatable is being into fx
how i can reload datatables into multiple functions ajax response when datatable is being into fx
function getBranchData() {
$.ajax({
type: 'GET',
url: 'includes/branches/getBranchData.php',
success: function (data) {
$('#BranchTable').html(data).DataTable();
}
});
}
Answers
now i want to reload this function into my next function response
function addBranch() {
$.ajax({
url: "includes/branches/addNewBranch.php",
type: "POST",
data: $("#addNewBranchForm").serialize(),
beforeSend: function () {
$("#loaderBranch").show();
$("#addBranch").hide();
},
success: function (data) {
$("#loaderBranch").hide();
$("#addBranch").show();
alert(data);
getBranchData().ajax.reload();
}
});
}
but it didnot show any result,please help if anybody can..thanks in advance
getBranchData() works parfectly but another call not working properly
It looks like you're initialising the table again with each call, so you would need to
destroy()
it first. It would be better to let DataTables handle the ajax, and just callajax.reload()
.Colin