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

164
Visualizações
How to print another page with a button using ajax

I wonder how to print another page without need to go the certain page that I need to print with a button.

I have a page called Receipts I already have Print button in it. On click to the print I want to print another page called Print.php which is there.

Here is my Ajax code:

        // Update bill status and print
        $(document).on('click', '.update_status', function(e){
            e.preventDefault();
            var ordernum=$(this).data("id");
            $.ajax({  
                url:"pages/UpdateBillStatus.php",  
                method:"POST",  
                data:{ordernum:ordernum},
                success:function(data){
                    document.getElementById('status'+ordernum).innerHTML = data;

                    // This is the part that I wrote but it still open the Print.php page then print
                    var printWindow = window.open('http://localhost/LaLigaCafe/pages/Print.php?ordernum='+ordernum+'');
                    printWindow.print();
                }
            }); 
        }); 

So what I need is printing the page without need to going there just printing in my current page.

Thanks in advance guys.

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