Export JSON to Variable
Export JSON to Variable
hpegmslicensemgmt
Posts: 23Questions: 8Answers: 0
Dear all,
I'm currently playing arround with the DataTables Export.json Buttons and I get a perfect JSON file for download.
Would it be possible to get the content saved in a variable and not saved to the browser ?
I would like to use the JSON Export to send the data to a RestAPI Interface.
Is this possible ?
Best regards,
David
Answers
Assuming you are using the
ajax
option to fetch the data you can use theajax.json()
API to retrieve the last fetched data set.The Export.json button is not a built-in button so I'm not sure how it works.
Kevin
Additional question, is there a way to export only visible columns ?
Yes, see this example.
Kevin
Additional question 2: is there a way to create a URL with Column-Name (Header) = Cell-Value
https://www.myserver.com/api.php?hostname=hercules&domain=ramseier.com&ip_address=10.0.0.55 etc ?
for each row of a DataTable ?
Best regards,
David
You should be able to use
columns.render
for that - it allows you to generate links (or anything else) using the raw data. There's an example on that page creating a URL,Colin