大家好,我需要一些帮助,即时消息试图在我的网站中加载datatable,但它不支持,即时消息尝试更改我的某些jquery,但它使我的其他功能无法正常工作,然后我尝试找到jq 1.10.2支持数据表,但不会加载并发送错误,这是我的代码:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="<?php echo base_url(); ?>asset/css/home_admin.css">
<!--css custom-->
<!-- <link rel="stylesheet" href="asset/css/home_admin.css"> -->
<!--jqueryui -> year slider -->
<link href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">
<!-- DATATABLE CSS -->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css" />
</head>
<body>
<div class="container">
<div class="row px-3">
<div class="col-12 card card-menu">
<div class="card-body">
<span style="color:white">test</span>
<div class="col-12">
<h2>title</h2><br>
<table id="table_id" class="display nowrap stripe row-border order-column" style="width:100%">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">...</th>
<th scope="col">....</th>
<th scope="col">.....r</th>
<th scope="col">.....</th>
<th scope="col">......</th>
</tr>
</thead>
<tbody>
<tr>
<td scope="row">1</td>
<td>Row 1 Data 2</td>
<td>Row 1 Data 2</td>
<td>Row 1 Data 2</td>
<td>Row 1 Data 2</td>
<td>Row 1 Data 2</td>
</tr>
<tr>
<td scope="row">2</td>
<td>Row 1 Data 2</td>
<td>Row 1 Data 2</td>
<td>Row 1 Data 2</td>
<td>Row 1 Data 2</td>
<td>Row 1 Data 2</td>
</tr>
</tbody>
</table>
</div>
<span style="color:white">test</span>
</div>
</div>
</div>
</div>
<!--JQUERY-->
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script src="https://code.jquery.com/ui/1.11.3/jquery-ui.js"></script>
<!-- INI SELECTOR -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<!-- bootsrap-->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<!-- DATATABEL -->
<script src = "http://cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js" defer >
<!-- <script src="https://cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"></script> -->
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.js"></script>
<!--js custom-->
<script src="<?php echo base_url(); ?>asset/js/diklat.js"></script>
<script src="<?php echo base_url(); ?>asset/js/select-dropdown.js"></script>
</body>
</html>
,错误日志为
jquery.js:3827 Uncaught TypeError: $(...).DataTable is not a function
at HTMLDocument.<anonymous> (name:287)
at mightThrow (VM21270 jquery.js:3534)
at process (VM21270 jquery.js:3602)
答案 0 :(得分:1)
尝试在头部加载所有脚本文件。因此,所有jquery文件都会在您的身体之前加载。