java - jquery datatables 未定义不是一个函数

标签 java javascript jquery ajax datatables

我当前使用数据表提供的 Ajax 函数,我仅将 url 更改为我自己的 url 和列数。这是我得到的错误

Error 未捕获的类型错误:未定义不是函数 $(document).ready(function() { alert('working'); $('#example').dataTable( { "processing": true, "serverSide": false, "ajax": { "url": "ViewOwnConsultServ", "type": "POST" }, "columns" : [ {"data" : "lecturename"}, {"data" : "date"}, {"data" : "starttime"}, {"data" : "endtime"}, {"data" : "school"} , {"data" : "team"} , {"data" : "status"} , {"data" : "problem"} ] } ); } ); 这是我的 HTML

<table id="example" class="display" cellspacing="0" width="100%">
            <thead>
                <tr>
                    <th>Lecturer's Name</th>
                    <th>Date</th>
                    <th>Start Time</th>
                    <th>End Time</th>
                    <th>School</th>
                    <th>Team</th>
                    <th>Status</th>
                    <th>Teacher's note</th>
                </tr>
            </thead>
        </table>

我怀疑这与我的 json 有关,但我检查了。下面显示了我的 servlet 的示例。数据表列是否应该 == 我的 json 字符串的参数数量?

Servlet json

最后这是我的 json 输出的示例

"data":[{"id":0,"staffid":0,"lecturename":"","starttime":"1pm","endtime":"2pm","roomno":0,"school":"Northland Secondary School","team":"northland","status":"Unconfirmed","date":"01/19/2015","problem":" can i PLEASE CONSULT YOU ON MATTER THAT DONT EXIST"},

哦,我忘了这是我的进口

imports

最佳答案

scripts 避免重复脚本对我有用,因为我使用某些 js 脚本重新添加到黑色 jsp 页面中。因为我没有意识到页面底部还有其他脚本

关于java - jquery datatables 未定义不是一个函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28336651/

相关文章:

javascript - Jquery 更改 .text(something) 然后返回

java - 当源附件不可修改时,如何将源附加到Gradle Eclipse项目中的jar中?

java - SAP JCo SAML 身份验证

java - 使用附加值或新值扩展 ImmutableMap

javascript - 修改数据表按钮操作

javascript - 使用 jquery 更改 CSS 适用于 .parent().addClass 而不仅仅是 .addClass

java - 编译语言和解释语言有什么区别?

javascript - JSON 数组未在 Google map 中获取

javascript - jQuery中从中间元素开始的数字元素

Javascript添加类并保持原始