部分代碼:
<button class="btn" type="button" id="templateDownload">模板下載</button>
模板放在當前項目中
js代碼:
var loaded = false;
$("#templateDownload").click(function () {
if (!loaded) {
$("<iframe id='downloadExcel' src='' width='0' height='0' frameborder='0'/>").appendTo("body");
loaded = true;
}
$("#downloadExcel").attr("src", "${ctx}/download/excel/highPrice.xls?t=" + new Date().getTime());
});