call a function in success of datatable ajax call

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

    Maybe it's not exactly what you want to do, but using the ajax complete solved my problem of hiding a spinner when the ajax call returned.

    So it would look something like this

    var table = $('#example').DataTable( {
        "ajax": {
                "type" : "GET",
                "url" : "ajax.php",
                "dataSrc": "",
                "success": function () {
                    alert("Done!");
                }       
        },
        "columns": [
                { "data": "name" },
                { "data": "position" },
                { "data": "office" },
                { "data": "extn" },
                { "data": "start_date" },
                { "data": "salary" }            
            ]
        } );
    

提交回复
热议问题