call a function in success of datatable ajax call

后端 未结 10 1974
难免孤独
难免孤独 2020-12-29 01:44

Is that possible to invoke a javascript function in success of datatable ajax call. Here is the code am trying to use,

var oTable = $(\'#app-config\').dataTa         


        
10条回答
  •  再見小時候
    2020-12-29 02:19

    The best way I have found is to use the initComplete method as it fires after the data has been retrieved and renders the table. NOTE this only fires once though.

    $("#tableOfData").DataTable({
            "pageLength": 50,
            "ajax":{
                url: someurl,
                dataType : "json",
                type: "post",
                "data": {data to be sent}
            },
            "initComplete":function( settings, json){
                console.log(json);
                // call your function here
            }
        });
    

提交回复
热议问题