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

141
Vistas
No puedo obtener el valor POST de ajax

Me gustaría obtener el valor de ajax con la publicación en php, pero esto no funciona, aquí está mi código:

 <script type="text/javascript"> function deletarPerson(id_person) { let pag = "<?php echo plugin_dir_url(__DIR__) . 'admin/'; ?>"; jQuery.ajax({ url: pag + "/config.php", method: "post", data: { id_person: id_person }, dataType: "html", success: function(result) { <?php $aux = $_POST['id_person']; ?> alert('<?php echo $aux ?>') }, }) } </script>

¿Puede ayudarme alguien?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Su código Javascript ajax:

 function deletarPerson(id_person) { jQuery.ajax({ url: "/echo.php", // <-- sending to echo.php on the server // ...use whatever PHP file, on the server, // you need to get the necessary information method: "post", data: { id_person: id_person }, dataType: "text", success: function(result) { alert(result) // <-- now use Javascript and the result variable, // which is text sent back from the server, // and do what you need to with it on the client }, }) }

... y su archivo PHP:

 <!-- echo.php --> <?php $aux = $_POST['id_person']; echo $aux; // <-- whatever is echo'ed or print'ed in this file // gets sent back to the server as text // and is loaded in the Javascript result variable // OR you can actually get some useful information from the server // and send that back instead ?>

Lea más sobre los distintos contextos de ejecución entre PHP en el servidor y Javascript/HTML/CSS... en el cliente .

about 4 years ago · Juan Pablo Isaza Denunciar
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