Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

160
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda