Ajax button and server side
Ajax button and server side
Guigoz
Posts: 8Questions: 0Answers: 0
Hi,
Tabletools doesn't export all informations with the server side system so I'm trying to use Ajax buttons in order to create my CSV/PDF files on the server side.
I've updated my server side PHP in order to create a CSV/PDF file if a $_GET['export'] parameter is sent instead of sending back datas.
The file is created by the server side PHP and the program returns the url of the created file.
With the fnAjaxComplete function i'm changing the source of an hidden iFrame to link to a downloadFile.php program which will send the file to the customer.
The system works fine but I have a last problem.
I want to export datas sorted and filtered like they are shown in the table.
So i need to send the aoData informations to my server side php with the extra 'export' parameter.
I just don't know how to execute this ajax request in the fnClick function linked to my ajax button.
[code]
{"sExtends": "ajax",
"sButtonText": "Ajax CSV",
"sAjaxUrl": "dataRequest.php?export=CSV",
"fnClick": function( nButton, oConfig ) {
//How to send good parameters to my server side PHP?
},
"fnAjaxComplete": function ( XMLHttpRequest, textStatus ) {
$("#dl_frame").attr('src','downloadFile.php?file='+XMLHttpRequest.exportFile);
},
}
[/code]
Thanks for your help,
Guillaume.
Tabletools doesn't export all informations with the server side system so I'm trying to use Ajax buttons in order to create my CSV/PDF files on the server side.
I've updated my server side PHP in order to create a CSV/PDF file if a $_GET['export'] parameter is sent instead of sending back datas.
The file is created by the server side PHP and the program returns the url of the created file.
With the fnAjaxComplete function i'm changing the source of an hidden iFrame to link to a downloadFile.php program which will send the file to the customer.
The system works fine but I have a last problem.
I want to export datas sorted and filtered like they are shown in the table.
So i need to send the aoData informations to my server side php with the extra 'export' parameter.
I just don't know how to execute this ajax request in the fnClick function linked to my ajax button.
[code]
{"sExtends": "ajax",
"sButtonText": "Ajax CSV",
"sAjaxUrl": "dataRequest.php?export=CSV",
"fnClick": function( nButton, oConfig ) {
//How to send good parameters to my server side PHP?
},
"fnAjaxComplete": function ( XMLHttpRequest, textStatus ) {
$("#dl_frame").attr('src','downloadFile.php?file='+XMLHttpRequest.exportFile);
},
}
[/code]
Thanks for your help,
Guillaume.
This discussion has been closed.
Replies