$(...).DataTable 不是使用 JQ 1.10.2 的函数

问题描述 投票:0回答:1

大家好,我需要一些帮助,我试图在我的网站中加载数据表,但它有点不支持,我尝试更改我的一些 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)
jquery datatable
1个回答
1
投票

尝试加载 head 部分中的所有脚本文件。所以所有 jquery 文件都会在你的 body 之前加载。

© www.soinside.com 2019 - 2024. All rights reserved.