I’ve used Datatables for a while now and on the same website, I have two separate pages that use it. One works and one gives me the JSON error in the title. The odd part is that I copied and pasted the code from the working page to create the not-working page and the responses both look valid.
JSON RESPONSE (APPARENTLY BAD… LOOKS FINE TO ME):
{“sEcho”:0,”iTotalRecords”:”190″,”iTotalDisplayRecords”:”2″,”aaData”:[[“4″,”1″,”1″,”2″,”0”],[“91″,”2″,”1″,”1″,”0”]]}
I found my mistake…
I was using “AS” in the mySQL SELECT query. Apparently that will prevent Datatables from parsing the response properly even though it looks correct.
BAD:
GOOD: