Sending data back to the front-end

Sending data back to the front-end

modernclixmodernclix Posts: 10Questions: 0Answers: 0
edited July 2010 in General
I would like to know how to send data back to the front end and how to access it.

I suppose that the first part would be something like this:

[code]
...
$output['aaData'] = $aaData;
$output['csvData'] = $csvData;
...
[/code]

But then how can I read that data with javascript?, I thought it was a trivial thing to do but couldn't figure it out yet. Any help will be appreciated.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You can use fnServerData to intercept the Ajax request and receipt: http://datatables.net/usage/callbacks#fnServerData

    Allan
  • modernclixmodernclix Posts: 10Questions: 0Answers: 0
    Thanks, and how would I access for example the raw json aaData or this 'csvData' I'm sending?

    I suppose it could be done using aoData right?
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    http://datatables.net/examples/server_side/custom_vars.html - just before calling the fnCallback function - you've got full access to the JSON object - DataTables is only interested in it's variables - you can access the csvData variable and do whatever with it :-)

    Allan
  • modernclixmodernclix Posts: 10Questions: 0Answers: 0
    Great, that example works, thanks!.
This discussion has been closed.