Skip to main content
se añadieron 480 caracteres en el cuerpo
Origen Enlace
   $(document).ready(function(){
    listar_datos();

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

                "columnDefs": [
                var tabla = $('#tabla_salario').DataTable(    {
 
                    "columnDefs"      "targets": [ 0 ],
                          "visible": {true
                       },    
    "targets": [ 0 ],
             ]
             });
       "visible": true}
    },'json');
     
    
}

function formatCurrency(num) {
    num = num.toString().replace(/\$|\,/g, '');
    if (isNaN(num))
 },   
     num = "0";
    sign = (num == (num = Math.abs(num)));
    num = Math.floor(num * ]
100 + 0.50000000001);
    cents = num % 100;
    num = Math.floor(num }/ 100).toString();
    if (cents < 10)
        cents = "0" + cents;
    for (var i = 0; i < Math.floor((num.length - (1 + }i)) / 3); i++)
        }num = num.substring(0,'json' num.length - (4 * i + 3);
) + ',' + num.substring(num.length - (4 * i + 3));
    return ((sign) ? '' : '-') + '$' + 
 num + '.' + cents;
}
});
<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>
$(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>
   $(document).ready(function(){
listar_datos();

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

                "columnDefs": [
                       {
                          "targets": [ 0 ],
                          "visible": true
                       },    
                    ]
             });
        }
    },'json');
     
    
}

function formatCurrency(num) {
    num = num.toString().replace(/\$|\,/g, '');
    if (isNaN(num))
        num = "0";
    sign = (num == (num = Math.abs(num)));
    num = Math.floor(num * 100 + 0.50000000001);
    cents = num % 100;
    num = Math.floor(num / 100).toString();
    if (cents < 10)
        cents = "0" + cents;
    for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
        num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3));
    return ((sign) ? '' : '-') + '$' + num + '.' + cents;
}
});
<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>
Origen Enlace

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]);