How to get the data in different keys of an ajax response?
How to get the data in different keys of an ajax response?
wohcknah
Posts: 2Questions: 1Answers: 0
The structure of the ajax reponse is like below:
{
"metadata": {
"foo": "",
"bar": "",
},
"maindata": [
{...},
{...},
...
]
}
I need to fill the data in "maindata" to the table body, and use the data in "metadata" for the table info. How to do it with one ajax request?
Answers
Use the
ajax.dataSrc
option.What table info?
Allan
Hi allan,
"table info" refers to the "Showing xx to xx of xx entries" on the left bottom of the table (not sure what's its official name).
You can use
info.callback
to modify the default message if the language string options don't suit your needs.Allan