Skip to main content
1 de 2

Intenta con esto, espero que te sirva

$(document).ready(function(){
    listar_datos();

    function listar_datos()
    {   
        $.get('lista.php', function(data){
            if( data.success ){
                for( var $item in data.salarios ){
                    $('#tabla_salario > tbody:last-child').append('<tr><td>'+data.salarios[$item]+'</td></tr>');
                }
                
                var tabla = $('#tabla_salario').DataTable({

                    "columnDefs": [
                           {
                              "targets": [ 0 ],
                              "visible": true
                           },   
                        ]
                 });
                
            }
        },'json');
        
        
    }
});
<script src="//code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="//cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="//cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css" type="text/css">

<table width="100%" class="table table-striped table-bordered table-hover" id="tabla_salario"> 
    <thead>
        <tr>
            <th>salario</th>
        </tr>
    </thead>
    <tbody>
        
    </tbody> 
</table>

lista.php ->

<?php
    $salarios = [];
    for($i = 0; $i < 1000; $i++){
        $salarios[] = mt_rand();
    }
    echo json_encode([ 'success' => true, 'salarios' => $salarios]);