Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

159
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda