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

185
Vistas
parse javascript variable as a PHP argument

i have my code like this :

<?php
include 'fonctions.php';

?>
<input type="button" onClick="chauffeur_info(330);" />
  <h1 id="header"></h1>
  <script>
    function chauffeur_info(matricule){
    console.log(matricule);
    var result = "<?php echo get_nom_prenom_chauffeur(matricule); ?>";
    document.getElementById("header").innerHTML = result;

    }
  </script>

when i call it like that it gives me an error, but when i do :

var result = "<?php echo get_nom_prenom_chauffeur(330); ?>";
document.getElementById("header").innerHTML = result;

it's working perfectly, any idea why it's not working.

PS: console.log is giving me the right value

Thanks in advance

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