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

166
Vistas
Inserting JavaScript variable inside php echo and reading it as a variable not a string

Hello I have this simple problem in my code. I'm using php echo to use my javaScript inside in my model, my question is I want to use my JS variable inside php echo and pass it through url using GET method my problem is my variable is read as string a variable

echo  "<script>
         $('.btnclick').on('click', function(){
             var ris_id = $(this).attr('data-id');

             window.open('pdf_report?d="."ris_id"."' , '_blank');
         });
       </script>"

Here's my sample code, my problem is that I want to pass the ris_id as a variable not a string to the new tab that will open after click the button.

about 4 years ago · Santiago Gelvez
2 Respuestas
Responde la pregunta

0

I think you should use simple javascript not jquery.

about 4 years ago · Santiago Gelvez Denunciar

0

The concatenation of string in JS or jquery will be done by (+) not by (.)

window.open('pdf_report?d="'+ris_id+'"' , '_blank');
about 4 years ago · Santiago Gelvez 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