Data format for Ajax requests
Data format for Ajax requests
spidogr
Posts: 23Questions: 9Answers: 0
I am considering using Ajax for medium-sized tables, but it is not clear to me in the linked example above what sort of format the data in the external txt file must be in. I can see in that example a call to /ajax/data/arrays.txt but what format should arrays.txt be in? Could I use a tab delimited file? In such a case, would I do it with header rows for each column name?
Answers
The format is shown in the Ajax tab of the example you linked to. Datatables supports JSON formatted data. See the Ajax manual for more info.
Kevin
The data is visible under the Ajax tab on the page you linked to.
No. json is expected.
Right thanks.
I tested and it seems to work. However, when I try to limit elements displayed by adding
"dom": 'frtip'
then it does not work. Do I need different syntax here? Nor if I change the arrays.txt to arrays.json.Look at the browser's console and you will see you have a syntax error. You need a comma between the options, like this:
Kevin
Great, thanks!