Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

170
Visualizações
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 Respostas
Responde à pergunta

0

I think you should use simple javascript not jquery.

about 4 years ago · Santiago Gelvez Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda