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

Razupk_ngomasterRazupk_ngomaster Posts: 3Questions: 1Answers: 0

function getBranchData() {
$.ajax({
type: 'GET',
url: 'includes/branches/getBranchData.php',
success: function (data) {
$('#BranchTable').html(data).DataTable();
}
});
}

Answers

  • Razupk_ngomasterRazupk_ngomaster Posts: 3Questions: 1Answers: 0

    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

  • Razupk_ngomasterRazupk_ngomaster Posts: 3Questions: 1Answers: 0

    getBranchData() works parfectly but another call not working properly

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    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 call ajax.reload().

    Colin

Sign In or Register to comment.