如何从JSON文件传递jQuery数据表的列名?

时间:2015-01-06 11:19:47

标签: json

这是我的代码:

$(document).ready(function () {
  var table = $('#employeeDetails').DataTable( {
    "lengthMenu": [[5,10 , 15, -1], [5, 10, 15, "All"]],
    "ajax": "employeeDetails.json",

    "aoColumns": [{
      "mData": "name" 
    },{
      "mData": "age"
    },{
      "mData":"designation"
    },{
      "mData": "salary"
    }]
  });
});

和HTML

<table id="employeeDetails">

</table>

如何从单独的JSON文件中获取列标题?

0 个答案:

没有答案