DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting e

DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting e

babukumargbabukumarg Posts: 2Questions: 0Answers: 0
edited August 2011 in DataTables 1.8
Hi

I'm using JQuery 1.4.4, JQuery UI 1.8.13 and Datatables 1.8.2. Trying to use a Ajax Data source and I get this error
[quote]DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.[/quote]

The response is
[code]
{'sEcho': 1,'aaData': [['All Customers', '315150', '1118579322.01', '147066', '519915717.07']], 'iTotalRecords':1, 'iTotalDisplayRecords': 1}
[/code]

Firebug was able to parse this response as JSON. But not datatables.

Please Help!

Replies

  • allanallan Posts: 61,697Questions: 1Answers: 10,102 Site admin
    That isn't strictly valid JSON since you have since quotes rather than double quotes: http://json.org/ . It is valid Javascript which is why it works in Firebug, but it is not valid JSON ( http://jsonlint.com ).

    Changing your single quotes to double will do it.

    Allan
  • babukumargbabukumarg Posts: 2Questions: 0Answers: 0
    Thanks for the Help. Changing to double quote worked.
This discussion has been closed.