springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-19 13:51:06
235
我试图使用php创建jquery数据表,但收到以下错误:DataTables警告:table id=document_table-invalid JSON响应。
以下是我的代码:
documents.php
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/css/bootstrap.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.3/css/dataTables.bootstrap4.min.css">
<title>Central American Management</title>
</head>
<body>
<div>
<input type="hidden" id="UserId" name="UserId" data-id="<?php echo($_SESSION['UserId'])?>"></input>
<div class="container-fluid">
<div class="row">
<div class="container">
<div class="btnAdd">
<button class="btn btn-primary btn-md" id="add-document"><i class="fa fa-plus " aria-hidden="true">
</i><span>Add Document</span></button>
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<table id="document_table" class="table">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Country</th>
<th>Shared</th>
<th>Uploaded BY</th>
<th>Uploaded Date</th>
<th>Options</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="col-md-2"></div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-container" id="modal-container"></div>
<script src="../javascriptfiles/Documents.js"></script>
</body>
</html>
documents.js
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/css/bootstrap.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.3/css/dataTables.bootstrap4.min.css">
<title>Central American Management</title>
</head>
<body>
<div>
<input type="hidden" id="UserId" name="UserId" data-id="<?php echo($_SESSION['UserId'])?>"></input>
<div class="container-fluid">
<div class="row">
<div class="container">
<div class="btnAdd">
<button class="btn btn-primary btn-md" id="add-document"><i class="fa fa-plus " aria-hidden="true">
</i><span>Add Document</span></button>
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<table id="document_table" class="table">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Country</th>
<th>Shared</th>
<th>Uploaded BY</th>
<th>Uploaded Date</th>
<th>Options</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="col-md-2"></div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-container" id="modal-container"></div>
<script src="../javascriptfiles/Documents.js"></script>
</body>
</html>
服务器端代码
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/css/bootstrap.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.11.3/css/dataTables.bootstrap4.min.css">
<title>Central American Management</title>
</head>
<body>
<div>
<input type="hidden" id="UserId" name="UserId" data-id="<?php echo($_SESSION['UserId'])?>"></input>
<div class="container-fluid">
<div class="row">
<div class="container">
<div class="btnAdd">
<button class="btn btn-primary btn-md" id="add-document"><i class="fa fa-plus " aria-hidden="true">
</i><span>Add Document</span></button>
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<table id="document_table" class="table">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Country</th>
<th>Shared</th>
<th>Uploaded BY</th>
<th>Uploaded Date</th>
<th>Options</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="col-md-2"></div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-container" id="modal-container"></div>
<script src="../javascriptfiles/Documents.js"></script>
</body>
</html>
我已经研究了一段时间,在做了大量研究后,我仍然不明白这个错误来自哪里。
顺晟科技:
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11