Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/444.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无法使用数据表_Javascript_Php_Jquery_Html_Datatables - Fatal编程技术网

Javascript 无法使用数据表

Javascript 无法使用数据表,javascript,php,jquery,html,datatables,Javascript,Php,Jquery,Html,Datatables,我无法成功使用Datatables库 我的建议包括: <link rel="stylesheet" type="text/css" href="<?php if ($prefix) echo '../'; ?>lib/bootstrap-4.3.1.css"> <link rel="stylesheet" type="text/css" href="<?php if ($prefix) echo '../'; ?>lib/DataTables/datat

我无法成功使用Datatables库

我的建议包括:

<link rel="stylesheet" type="text/css" href="<?php if ($prefix) echo '../'; ?>lib/bootstrap-4.3.1.css">
<link rel="stylesheet" type="text/css" href="<?php if ($prefix) echo '../'; ?>lib/DataTables/datatables.min.css"/>
<script type="text/javascript" src="<?php if ($prefix) echo '../'; ?>lib/jquery-3.5.0.js"></script>
<script type="text/javascript" src="<?php if ($prefix) echo '../'; ?>lib/DataTables/datatables.min.js"></script>

<link rel="stylesheet" type="text/css" href="<?php if ($prefix) echo '../'; ?>CSS/default.css">
<script type="text/javascript" src="<?php if ($prefix) echo '../'; ?>JS/script1.js"></script>
<script type="text/javascript" src="<?php if ($prefix) echo '../'; ?>JS/script2.js"></script>
下表:

<table class="display">
    <caption class="text-center">Employés</caption>
    <thead>
        <tr>
            <th>Nom</th>
            <th>Prénom</th>
            <th>Fonction</th>
            <th>Téléphone</th>
            <th>Courriel</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($employees as $employee) { ?>
        <tr>
            <td><?= utf8_encode($employee['nom']) ?></td>
            <td><?= utf8_encode($employee['prenom']) ?></td>
            <td><?= utf8_encode($employee['fonction']) ?></td>
            <td><?= utf8_encode($employee['telephone']) ?></td>
            <td><?= utf8_encode($employee['courriel']) ?></td>
        </tr>
        <?php } ?>
    </tbody>
    <tfoot>
        <tr>
            <th>Nom</th>
            <th>Prénom</th>
            <th>Fonction</th>
            <th>Téléphone</th>
            <th>Courriel</th>
        </tr>
    </tfoot>
</table>

但它不起作用。我试着按照目录的顺序来写。你知道吗?

解决我问题的另一种方法是,如果我在数据表的第二行和第三行之间添加警报(“某些消息”),则使用intead of。

。警报永远不会显示。所以我想在第2行调用Datatable函数时会出现问题。@Sevia,您正在加载两个DataTables库。请尝试删除最后一个版本或具有最新版本的版本。@ubuntux您确定还是可以更具体一些?js只是我调用datatables()的3行脚本。我想我加载了datatables css和js以及jquery js。@ubuntux感谢您的参与。您是否能够按照您的建议执行此操作?当页面加载时,您的浏览器控制台中会出现哪些警告/错误?将该信息添加到您的问题中。(请尝试使用F12打开控制台,或使用谷歌搜索特定浏览器。)
<table class="display">
    <caption class="text-center">Employés</caption>
    <thead>
        <tr>
            <th>Nom</th>
            <th>Prénom</th>
            <th>Fonction</th>
            <th>Téléphone</th>
            <th>Courriel</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($employees as $employee) { ?>
        <tr>
            <td><?= utf8_encode($employee['nom']) ?></td>
            <td><?= utf8_encode($employee['prenom']) ?></td>
            <td><?= utf8_encode($employee['fonction']) ?></td>
            <td><?= utf8_encode($employee['telephone']) ?></td>
            <td><?= utf8_encode($employee['courriel']) ?></td>
        </tr>
        <?php } ?>
    </tbody>
    <tfoot>
        <tr>
            <th>Nom</th>
            <th>Prénom</th>
            <th>Fonction</th>
            <th>Téléphone</th>
            <th>Courriel</th>
        </tr>
    </tfoot>
</table>
jquery-3.5.0.js:4046 jQuery.Deferred exception: jQuery.phpPrefilter is not a function TypeError: jQuery.phpPrefilter is not a function
jquery-3.5.0.js:5032 Uncaught TypeError: jQuery.phpPrefilter is not a function