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

127
Vistas
ajax call for a Post method without form

I'm using a simple form to print an pdf file using tcpdf. With the form the pdf is well generated on a new page printOrder.php

    <form action="php_action/printOrder.php" method="POST" target="_blank">
        <input type="text" name="orderId" id="orderId">

        <input type="submit" name="submit_btn">

    </form>

Now instead of using a form i would like to use a jquery function on aclick event that post the data and open the pdf on the new page printOrder.php. I have tried but this is not working. (Error : Warning: Undefined variable $pdf)

function printOrder(orderId = null) {
    if (orderId) {
        $.ajax({
            url: 'php_action/printOrder.php',
            type: 'post',
            data: { orderId: orderId },
            dataType: 'text',
            success: function (response) {

                var w = window.open('php_action/printOrder.php');
                w.document.open();
                w.document.write(response);
                

            }// /
        }); // /
    } // /if orderId
} // /
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