I do not handle much the DataTables
for which I tried several ways to convert a result of ajax
that are numbers and convert them into salary, but since I am handling it in a different way than the DataTables
it suddenly becomes I'm going with the idea.
I would appreciate if you could solve my problem.
HTML:
<table id="tabla_salario" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>salario</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
JQUERY / AJAX:
var tabla = $('#tabla_salario').DataTable({
"columnDefs": [
{
"targets": [ 0 ],
"visible": true
},
],
});
listar_datos();
function listar_datos()
{
$.ajax({
url: 'listar_salario',
type: 'POST'
})
.done(function(data)
{
var dato = $.parseJSON(data);
for (var i = dato.length - 1; i >= 0; i--)
{
var rowNode = tabla
.row.add([ dato[i].salario, ])
.draw()
.node();
}
})
.fail(function() {
console.log("error");
});
}