未捕获的TypeError:$(...)。dataTable不是函数

时间:2016-05-17 18:23:58

标签: javascript php jquery datatables

我的php文件有错误。 我检查了我的图书馆订单,但我认为是正确的。 这是我的脚本代码:

< script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.12.0.min.js"></script>

<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js">
</script>

<script>    

    $(document).ready(function() {
        $('#tablaLocalizaciones').dataTable({

            "ajax": "tabla.php",
                "columns":[
                { "data":"nombre"},
                { "data":"tipo"},


                ]



        });

    } );

</script>

任何想法? 感谢

1 个答案:

答案 0 :(得分:1)

在加载任何与jQuery相关的代码(如jQuery DataTables)之前,需要加载jQuery,如下所示:

<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery.dataTables.js" type="text/javascript"></script>

此外,对于生产版本,建议加载缩小版本(以.min.js结尾)。你可以看到它here

相关问题