call a function in success of datatable ajax call

后端 未结 10 1997
难免孤独
难免孤独 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:25

    Based on the docs, xhr Ajax event would fire when an Ajax request is completed. So you can do something like this:

    let data_table = $('#example-table').dataTable({
            ajax: "data.json"
        });
    
    data_table.on('xhr.dt', function ( e, settings, json, xhr ) {
            // Do some staff here...
            $('#status').html( json.status );
        } )
    
    

提交回复
热议问题