假设我在索引页上有一个表,当触发某个事件时,该表会动态更改。
假设我有另一个文件:excel.php,它生成excel表。
我想运行excel.php文件(它开始下载一个excel文件),停留在索引页面上,我正在使用下面的jquery脚本。
$("#user_period_table_excel_btn").on("click", function(ev) {
window.location.href = 'excel.cfm';
ev.preventDefault();
return false;
});
但问题是,我想在下载之前将索引页上的表htmls添加到excel.php文件中。换句话说,我想把索引页中的值传递给excel.php文件。
我不能使用get方法,因为表非常非常大。
Excel.php
$tab_content=/* I want to assign the table html code on index.html page*/
/*php script for generating $tab_content to excel sheet*/
欢迎提供任何帮助/建议。
window.location.href = 'excel.php?param=123';
在excel.php的末尾,简单地输出excel文件内容
header("Content-Disposition: attachment; filename='"excel.xls");
header("Content-Type: application/force-download");
readfile('excel.xls')
die();