我目前正在使用数据表提供的Ajax函数,我只将url更改为自己的url和列数。这是我得到的错误
未捕获的TypeError:undefined不是函数$(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的示例。datatables列是否应该===我的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"},
哦,我忘了这是我的进口
避免重复的脚本对我有用,因为我使用某些js脚本重新添加到黑色的jsp页面中。因为我不知道页面底部还有其他脚本
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句