No data available in table

网上扒了一个datatable的表格,但是不会用,数据源不会绑定,显示No data available in table,只有写在表格里的静态数据才有用

img

img

$('.datatable').DataTable( {
  "ajax":{
    "url": "http://localhost:8080/SmartOA/user/getall",
    "dataSrc":"data",
  },
  "columns": [
    { "data": "id" },
    { "data": "name" },
    { "data": "email" },
    { "data": "islogin" },
    { "data": "createtime" },
    { "data": "status" }
  ]
} );


```html
<table class="datatable table table-striped" cellspacing="0" width="100%">
                                    <thead>
                                    <tr>
                                        <th>Name</th>
                                        <th>Position</th>
                                        <th>Office</th>
                                        <th>Age</th>
                                        <th>Start date</th>
                                        <th>Salary</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                </table>




接口是通的,路径没问题

接口返回的数据没有data属性,题主检查下服务器端具体返回的数据格式到底是什么的?开发工具看下xhr选享卡发送请求后返回的数据

现在loading,控制台Cannot read properties of undefined (reading 'length')

img

路径有问题吧