Using ajax to load a jQuery DataTable

前端 未结 2 797
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-16 19:59

I\'m trying (and failing) to load a jQuery DataTable using the built-in ajax source argument. The datatable, however, shows the message \"Loading...\" where the row(s) shou

2条回答
  •  清酒与你
    2020-12-16 20:45

    If your ajax source returns

    [[[Hello], [Goodbye], [Test1], [Test2]]]
    

    This is not ok for datatables. It should be:

    {
         iTotalRecords: "54",
         iTotalDisplayRecords: "22",
         aaData: "[['Hello', 'Goodbye', 'Test1', 'Test2']]"
    }
    

    aaData stands for array of arrays.

提交回复
热议问题