Datatables invalid json that's actually valid?
Datatables invalid json that's actually valid?
My json is passing validation. But when data tables pulls it from ajax I get the invalid json error. What am I missing?
My json:
[{"category":"","user_display":"","appchk_txt":"Driver's License ","appchk_rid":"121","user_txt":"","appchk_cod":"DL"},{"category":"","user_display":"","appchk_txt":"Reference ","appchk_rid":"128","user_txt":"","appchk_cod":"RF"},{"category":"","user_display":"","appchk_txt":"Reference: School Counselor ","appchk_rid":"149","user_txt":"","appchk_cod":"11"}]
Answers
There must be some other data being returned that is making the data invalid JSON. Can you link to the page or use the DataTables debugger, as per the forum rules please.
Allan
From ajax reference:
" By default DataTables will look for the property data (or aaData for compatibility with DataTables 1.9-) when obtaining data from an Ajax source or for server-side processing"
So, for example:
I'm not entirely certain what baring that has on the Invalid JSON error? Both of what you posted are valid JSON, but if you are getting an error from DataTables stating that the JSON is invalid, then a JSON parsing error is being reported by jQuery. As I say, we would need either a link to the page or a debugger trace to offer any help resolving the problem.
Allan
I was fooling around with the issue and was getting Invalid JSON response when not including the data in the aaData property. When testing again to send to you it does not. I must have actually been testing with bad JSON. Sorry to waste time.