我正在使用 jquery Datatables 并且收到此错误:DataTables 警告:table id=example - Ajax error。这是 MVC 应用程序。数据来自 MSQL 数据库。在 chrome 的控制台上没有错误。也许这是一个语法问题?这是我的 .jsp 文件: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %><%@ page contentType="text/html;charset=UTF-8" language="java" %><html><head> <title></title> <script> function confirmDelete(id) { if (confirm("Are you sure to delete this cost?")) { window.location.href = "/cost/delete/" + id; } } </script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <link rel="stylesheet" href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css"> <script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script> <script src="../../resources/js/datatable.js"></script></head><body><table id="example" class="display" style="width:80%"> <thead> <tr> <th>ID</th> <th>Date</th> <th>MPK</th> <th>Account</th> <th>Client</th> <th>Amount</th> <th>Description</th> <th>Payment</th> <th>Invoice Number</th> <th>Department</th> <th>Delete</th> <th>Edit</th>
1 回答
慕村9548890
TA贡献1884条经验 获得超4个赞
请改用以下初始化代码:
$(document).ready(function () {
$('#example').DataTable({
pageLength: 5
});
});
添加回答
举报
0/150
提交
取消