Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
Using PHP and Javascript to animate Download button

My PHP based web app has an "export" button that works. This is what it looks like. What I want to do is, once the data is exported then change that icon to a green checkbox. My PHP code on notes.php looks like:

if(isset($_POST['export_notes_to_excel'])){
  $sql_for_export = explode("ORDER", $_SESSION['sql']);
  $sql_for_export = $sql_for_export[0];
  $filename = "Notes Exported On - " .date('Y-m-d');
  $column_names = array("[Id]" => "ID", "[DateAdded]"=>"Date Added", "[Entry]"=>"Enty", "[AddedBy_Id]"=>"Officer ID");
  export_sql_to_excel($sql_for_export, $filename,$column_names);
}

This code works fine and I was trying to use JS here but the problem is PHP does not render my JS if I do something like:

echo "<script>console.log('test');</script>";

after the export_sql_to_excel() function call. I wanted to do 2 things actually. First, change that download icon to a loading icon when the file is being prepared by PHP and then a checkbox icon once the file is downloaded. Any help would be appreciated. Can this even be done with PHP being the server side code? Thank you.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!