Thanks for help.
I created Print button and function print() that sends ajax POST
request with sform fields (this was my problem , how to get field
values from sform) to print.php.
Then open a new window and write response.
That's ok for printing option.
function print(com,grid)
{
if (com=='Print')
{
var sform_data = $('#sform').serializeArray();
$.ajax({
type: "POST",
dataType: "json",
url: "print.php",
data: sform_data,
success: function(data){
var pwin = window.open("",
"printwin","width=400,height=600");
pwin.document.open()
pwin.document.write(data)
pwin.document.close()
pwin.print()
}
}
}
print.php
-----------------
<?php
var_dump($_POST);
//process post fields.. generate sql query .. return results
?>
For export option after processing data from db I want to force
download xls file generated from php.
I used this headers
export.php
-------------------
<?php
//get records from db
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");;
header("Content-Disposition: attachment; filename=exportfile.xls");
//print xls file
?>
But using ajax requests only in Firebug I can see response
Also accessing export.php directly in browser work well (using GET for
parameters).
Is there a way to POST sform fields to export.php on a new window, or
an iframe to force download ?
Or maybe I should write result_xls_file on server and put a link to
it ?
Or add other form on page and onClick flexigrid Export button submit
it with sform values ?
What is the right method to do it ?
> > Thank's- Hide quoted text -
>
> - Show quoted text -