What is the JSON data for fnReloadAjax supposed to look like?

What is the JSON data for fnReloadAjax supposed to look like?

rkorebritsrkorebrits Posts: 8Questions: 1Answers: 0
edited December 2012 in General
Hi there,
We are currently refreshing pages when we are adding data to a table, but instead we want to use the fnReloadAjax function to get the data smarter. I however haven't been able to find any info of what the AJAX source is supposed to look like. I assume the data is JSON?

Is it just an array of objects, with the same count of items in an object as columns in a table?

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    An array of arrays with the `aaData` used is the default:

    [code]
    {
    "aaData": [
    [... row 1...],
    [... row 2...],
    [... row 3...]
    ]
    }
    [/code]

    But using mData you can have an array of objects returns and with sAjaxDataProp you can return just an array or change the `aaData` to anything you want.

    Allan
  • rkorebritsrkorebrits Posts: 8Questions: 1Answers: 0
    Thanks, so 2 rows with each 3 columns would look like this:

    [code]
    {
    "aaData": [
    ["1", "Richard", "Lorem"],
    ["2", "Allan", "Ipsum"]
    ]
    }
    [/code]
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Yup - perfect.
This discussion has been closed.