Skip to content
Advertisement

DataTables Requested unknown parameter ‘PageId’

I am running into the following error trying to load DataTables Objects data (https://datatables.net/manual/data/):

JavaScript

Below is example json data I am recieving from my C# SchemaReport/GetReportJson controller and being used in JQuery ajax success callback to initialize my DataTables:

JavaScript

DataTables HTML:

JavaScript

JQuery ajax and DataTables init script:

JavaScript

I noticed that after acknowledging the error DataTables loads as following and stating 134 entries:

enter image description here

134 matches the character count of the json data (provided in answer). For some reason it appears DataTables is not seeing the json object and parsing individual characters? Just not sure why it would be doing this?

Advertisement

Answer

Your columns block should be:

JavaScript

You should also be sending your data from the Controller like this:

JavaScript

You do not need to serialize your data when you are returning a JSON since this will already return data in JSON format and if you use JsonConvert.SerializeObject then you are converting it twice which the DataTable plugin does not like.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement