我下载的表格只打印标题,不显示任何内容。 我正在按照此处的教程进行操作:http://webslesson.blogspot.in/2016/02/export-mysql-data-to-excel-in-php-php-tutorial.html
我尝试过的以下插件无法呈现我的大量数据 1.clarketm(合并行) 2.(尝试过但无法渲染大量数据)https://github.com/kayalshri/tableExport.jquery.plugin
我的 HTML DOM 是 (index.php)
<div id="allTables">
<table border="2" width="100%">
<tr>
<th width="30%">Name</th>
<th width="20%">Activity on Code Project (%)</th>
<th width="10%">Activity on C# Corner (%)</th>
<th width="10%">Activity on Asp Forum (%)</th>
</tr>
<tr>
<td>Sibeesh</td>
<td>100</td>
<td>98</td>
<td>80</td>
</tr>
<tr>
<td>Ajay</td>
<td>90</td>
<td>0</td>
<td>50</td>
</tr>
</table>
</div>
<p id="exportexcel">EXport to Excel</p>
<script>
$(document).ready(function () {
$('#exportexcel').click(function(){
var excel_data = $('#allTables').html();
console.log(excel_data);
var page = "excel.php?data="+excel_data;
console.log(page);
window.location = page; // here iam sending data to excel.php through get method
});
</script>
我的excel.php文件是
<?php
header('Content-Type: application/vnd.ms-excel');
header('Content-disposition: attachment; filename='.rand().'.xls');
echo $_GET["data"];
?>
--请帮助我做错了什么,提前致谢
最佳答案
C# Angular (%) 上的事件 - 此行中的“#”导致了问题。对此进行编码将解决上面代码中的问题。
但最好按照建议使用 POST。
关于javascript - 无法使用 jquery 和 php $_GET 导出 html 表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39444924/