Skip to content
Advertisement

referencing json data in datatables – howto

I have an external json file as follows (fake data);

JavaScript

I call the table like below and, as expected it works;

JavaScript

I want to change the array name in the json file to properties and so have revised above as follows;

JavaScript

and change the datafile to;

JavaScript

I get an error as follows;

JavaScript

I have tried to read the man pages here https://datatables.net/manual/data/#Objects but I am certainly missing something. Any pointers appreciated.

Advertisement

Answer

JavaScript

should be

JavaScript

data is not a key in your data, it’s a specific property in the API.

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