Download a file with an ajax call

前端 未结 5 431
面向向阳花
面向向阳花 2021-01-13 11:25

I am using PHPExcel to read an excel template, populate the data, and ask the user to download the file.

generate_excel.php

$objPHPExcel = PHPExcel_I         


        
5条回答
  •  醉话见心
    2021-01-13 11:36

    Not everything should be done with AJAX. Sometimes plain old HTML is more suitable for a job. I guess your button has a tag? Why won't you do something like this

    Export to Excel
    

    in your HTML? Note the target="_blank" part. It's there to make sure your page is not reloaded.

    For input you can use construct

    ...whatever

提交回复
热议问题