2013-07-25 33 views
0

假設我在索引頁上有一個表,當某個事件被觸發時它會動態變化。下載按鈕單擊文件並將值發送到下載文件作爲參數

可以說我有另一個文件:生成excel工作表的excel.php。

我想運行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*/ 

任何幫助/建議表示讚賞。

回答

-1
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(); 
+0

我說過,我不能由get發送對 –

相關問題