I am current using a Ajax function provided by the datatables i only change the url to my own url and the number of columns. This is the error i get
Uncaught TypeError: undefined is not a function
$(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"} ] } ); } );
Here is an my 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>
I suspected it was something to do with my json but i checked. The below shows an example of my servlet. Does the datatables column should be == to the number of parameter of my json string?
Lastly this is an example of my json output
"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"},
Oh i forgot this are my imports
AVOID DUPLICATE SCRIPTS works for me because I re added into a black jsp page with certain js scripts. Because i din't realize there were other scripts at the bottom of the page
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.