html5 - datatables 加载不出来数据。
某草草
某草草 2017-06-14 10:52:16
0
2
961

我在后台已经请求到了json数据,如下`

[{"aid":100000,"name":"JYCM201609010250","rtsp":"947|100000|3750","statuz":"1","updateTime":"2017-05-31"},{"aid":100001,"name":"gui","rtsp":"947|100000|3750","statuz":"0","updateTime":"2017-05-31"}]

下面是我的js 代码

<script>
    $(document).ready(function () {
        $('#table_id_example').DataTable({
            "iDisplayLength": 10,
            "bLengthChange": false,
            "ajax": {
                "url": "/media",
                "dataType": "json",
                "success": function (json) {
                    console.log(json)
                }
            },
            "columns": [
                {
                    "data": 'aid'

                },
                {
                    "data": 'name'

                },
                {
                    "data": 'rtsp'

                },
                {
                    "data": 'statuz'

                },
                {
                    "data": 'updateTime'

                }
            ]
        });
    });
</script>

后台代码

  @Autowired
    private MediaImpl media;
    @ResponseBody
    @RequestMapping(value = "/media",method = RequestMethod.GET)
    public List<Media> MediaAll(){
        System.out.println("------------------------------------------------------");
        return media.findAll();
    }

html代码

<link rel="stylesheet" href="/css/jquery.dataTables.css" th:href="@{css/jquery.dataTables.css}"/>
<script type="text/javascript" src="/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
<script type="text/javascript" src="/js/jquery.dataTables.js" th:src="@{js/jquery.dataTables.js}"></script>
<body>

<table id="table_id_example" class="display" cellspacing="0" width="100%">
    <thead>
    <tr>
        <th>媒资ID</th>
        <th>媒资名称</th>
        <th>播放串</th>
        <th>状态</th>
        <th>更新时间</th>
    </tr>
    </thead>
    <!--    <tbody>
            <tr>
                <td>Row 1 Data 1</td>
                <td>Row 1 Data 1</td>
                <td>Row 1 Data 1</td>
                <td>Row 1 Data 1</td>
                <td>Row 1 Data 1</td>
            </tr>
        </tbody>-->
</table>

</body>

前后台都没有报错,但就是显示不出来数据。请问是少配置还是那块书写错误,谢谢

某草草
某草草

최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!