Please help me to refresh jquery datatable after insert (not page refresh but datatable only)

Please help me to refresh jquery datatable after insert (not page refresh but datatable only)

anamanam Posts: 2Questions: 2Answers: 0
$(document).ready(function(){       // first table view data
    var table = function(data){
    $("#datatable").dataTable({
    data:data,
    columns:[
    {'data':'no'},
    {'data':'id'},
    {'data':'name'},
    {'data':'address'},
    {'data': function (data, type, row, meta) {
    return '<button id="upd">Update</button>'+
    '</a>'+'<a href="../controller/student.php/delete_student/?id=' + data.id + '" id="del">' + "Delete" +
    '</a>';
    }
    },
    ]
    });
    }
  $.ajax({
    url: "../controller/student.php/send_student",
    method: "POST",
    dataType: "json",
    success: table
    });
  
$('.btnadd').bind('click', function(){    //click function to insert data
    var nis=$('#id').val();
    var name=$('#name').val();
    var alamat=$('#address').val();
    $.ajax({
    url: "../controller/student.php/add_student",
    type:"POST",
    data:"id="+id+"&name="+name+"&address="+address,
    success:function(){
    alert("data saved");
                                        //Please help me to refresh datatable after insert code here ?????????????
    }
    });
  
    $('#id').val(null);
    $('#name').val(null);
    $('#address').val(null);
  
    });
  
    $(".dataTables_filter input").css({ "margin-bottom" :"2px" });
    $(".dataTables_filter input").css({ "font-family" :"Helvetica" });
});

    $(document).ready(function(){
    $("#popup_window").click(function(){
    $('#id').val(null);
    $('#name').val(null);
    $('#address').val(null);
    });
    });



 





This discussion has been closed.