put ajax response on datatbles under .done(); [SOLVED]

put ajax response on datatbles under .done(); [SOLVED]

davisvasconcellosdavisvasconcellos Posts: 12Questions: 2Answers: 0
edited August 2014 in Free community support

how i can make this work?
put result ajax on datatables under .done()?

thanks.

ajaxTest:

{
    "aaData": [
        {
            "nome": "Vivere Jardim Residenc",
            "dt_lancto": "08/12/2012",
            "incorporador": "Construtora Angeleti",
            "rsm2atual": "R$ 189",
            "totalUnidades": "155",
            "totalPermutas": "0",
            "totalVendas": "0",
            "percentVendas": "0%",
            "dt_atual": "08/12/2012"
        },
        {
            "nome": "Residencial Mônaco Vil",
            "dt_lancto": "02/06/2014",
            "incorporador": "OSBRI",
            "rsm2atual": "R$ 0",
            "totalUnidades": "10",
            "totalPermutas": "0",
            "totalVendas": "0",
            "percentVendas": "0%",
            "dt_atual": ""
        }
    ]
}

Script:

            $.post( "ajaxTest.asp", $( "#myform" ).serialize())
                .done(function(data) {
                    var array = JSON.parse(data);
                                
                    $('#empLancTable').dataTable({
                        "bDestroy": true,
                        "aaData": array, // <-- Json
                        "aoColumns": [
                            { "mData": "nome" , "sWidth": '150px'},
                            { "mData": "dt_lancto", "sWidth": '105px', "sType": "date-uk", "sClass":"alignUnidades" },
                            { "mData": "incorporador", "sWidth": '150px' },
                            { "mData": "rsm2atual", "sWidth": '100px',"sType": "currency", "sClass":"alignUnidades" },
                            { "mData": "totalUnidades", "sWidth": '100px', "sClass":"alignUnidades" },
                            { "mData": "totalPermutas", "sWidth": '100px', "sClass":"alignUnidades" },
                            { "mData": "totalVendas", "sWidth": '100px', "sClass":"alignUnidades" },
                            { "mData": "percentVendas" , "sWidth": '100px',"sType": "percent", "sClass":"alignUnidades"},
                            { "mData": "dt_atual","bSortable":true,"sType": "date-uk", "sWidth": '105px', "sClass":"alignUnidades" }
                            ]
                });
                        
            });

[Solved]

"aaData": array.aaData
This discussion has been closed.