我正在使用jquery数据表,但出现此错误:数据表警告:表id = example-Ajax错误。这是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>
</tr>
</thead>
<tbody>
<c:forEach var="costs" items="${allcosts}">
<tr>
<td>${costs.id}</td>
<td>${costs.salesDate.toString()}</td>
<td>${costs.mpk.code}</td>
<td>${costs.account.code}</td>
<td>${costs.client.name}</td>
<td>${costs.amount.toString()}</td>
<td>${costs.description.toString()}</td>
<td>${costs.payment.type}</td>
<td>${costs.invoiceNumber.toString()}</td>
<td>${costs.department.name}</td>
<td><a href="#" onclick="confirmDelete(${costs.id}, '${costs.id}')">Delete</a></td>
<td><a href="/cost/update/${costs.id}">Edit</a></td>
</tr>
</c:forEach>
</tbody>
</table>
<spring:url value="/report/?type=xls" var="xlsURL"/>
<a href="${xlsURL }">Download Excel</a>
</body>
</html>
这是我的.js文件:
$(document).ready(function () {
$('#example').DataTable({
"processing": true,
"serverSide": true,
"pageLength": 5,
"ajax": {
"url": "/cost/all",
"columns": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
{"data": "Delete"},
{"data": "Edit"}
]
} });
});
如何解决此问题?我被困住了。
答案 0 :(得分:0)
请改用以下初始化代码:
t=2019-08-06T18:00:46+0000 lvl=eror msg=login.OAuthLogin(NewTransportWithCode) logger=context userId=0 orgId=0 uname= error="Post https://test-xyz.domain.com:31809/auth/realms/ABC/protocol/openid-connect/token: x509: certificate is valid for *xyz.domain.com, not test-xyz.domain.com"