An excel export button exists on the page for passing parameters to phpexcel. how can I upload the parameters on the page to the background by clicking the button (the front-end page does not jump to) to export the corresponding excel. & Lt; input & nbsp; typesubmit & nbsp; valueSave & nbsp; as & nbsp; Excel & nbsp; & gt; & amp; am page parameters passed to phpexcel
There is an excel export button on the page. how to click the button to upload the page parameters to the background (the front-end page does not jump) to export the corresponding excel.
《script》
$(document).ready(function(){
$("#excel").click(function(){
$.ajax({
type:"POST",
url:'excel_GlobalNetwork.php',
data:{area:$('#area').combobox('getValues').join(","),level:$('#level').combobox('getValues').join(","),bt:$('#bt').datebox('getValue'),et:$('#et').datebox('getValue')}
});
return false;
});
At present, I did this and found that the page does not jump or excel output, please master the instructions, how to modify the code.
------ Solution --------------------
Sao Nian. Your ajax just passes the data and does not get any output. How can I download the file.
In addition, download is an output file, so you do not need to add the passed parameters to ajax. a href = excel_GlobalNetwork.php.
And. Your excel button only downloads files and does not need to submit a form. Therefore, you only need to type = "button" instead of submit. Otherwise, the form will be submitted even if the click event is added, this is equivalent to refreshing the page.