Receiving DataTables Alert due to Json error, but Json Lint validates it
Receiving DataTables Alert due to Json error, but Json Lint validates it
hanoncs
Posts: 9Questions: 3Answers: 0
My datatable will not load data. I am receiving the correct data back in json, but DataTables alerts me that I have a json error. If I validate that json it comes back as valid. Any ideas?
Here is my debug #: ajesok
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
In your debug trace click the "Tables" tab and then "Server interaction". That shows what is being sent back from the server and it is most certainly not valid JSON :-)
Allan
Wow, this is all I see in chrome dev tools network preview of my get request...
{"sEcho":1,"recordsTotal":2161,"recordsFiltered":2161,"aoData":[["3243-1"],
["3243-2"],
["10-3"],
["3243-4"],
["10-5"],
["3084-6"],
["3282-7"],
["3282-8"],
["3282-9"],
["3282-10"]]}
Thank you allan. I discovered that my Header was returning the html with the json. I can now fill the datatable. My new issue is that the sorting, paging and search is not working. I will post my code below. I found an old mssql file on here so I modified for sqlsrv and now I am having these issues. I didnt change much.
Are you using a legacy version of DataTables, or have you enabled the legacy mode in 1.10 as that is certainly a legacy script.
Allan
That is a script I fount on here. I'm using a MS SQL Database, and I thought it would be better to use that script instead of trying to modify ssp.class.php to work with sqlsrv. Do you have any recommendations for anyone using sqlsrv for datatables? Or a link to read more on enabling legacy mode.
Thank you sir.
It is in the manual.
The other option is to update the above script to work with the 1.10 parameters - also described on the linked page.
Allan
Thank you sir i will give it a try.
thanks Allan :D