Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Call a javascript function after SAjaxsource completes in JQuery Datatables

I'm using JQuery SAjaxsource How can i Call a javascript function after SAjaxsource completes. I want to update a div after the completion of the datatable load.Please help me...

Edit:

$(document).ready( function() {
                var oTable = $('#example').dataTable( {

                    "bServerSide": true,
                                    "sSearch":false,
                                    "aLengthMenu": [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
                                    "bPaginate": true,
                                    "bJQueryUI": true,
                                    "sPaginationType": "full_numbers",
                                    "sAjaxSource": "server_processingCDB1.php"
                } );
like image 672
Arasu Avatar asked Jul 17 '26 04:07

Arasu


1 Answers

take a look at the fnServerData option in the callbacks section of the help -> http://www.datatables.net/usage/callbacks

Gives you everything you need ... here some example code :

$(document).ready(function() {
    $('#example').dataTable( {
        "bProcessing": true,
        "bServerSide": true,
        "sAjaxSource": "../examples_support/server_processing.php",
        "fnServerData": function ( sSource, aoData, fnCallback ) {
            $.getJSON( sSource, aoData, function (json) { 
                /* Do whatever additional processing you want on the callback, then tell DataTables */
                fnCallback(json)
            } );
        }
    } );
} );
like image 176
Manse Avatar answered Jul 18 '26 17:07

Manse



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!