Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
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 answers
Answer question

0

I think you should use simple javascript not jquery.

about 4 years ago · Santiago Gelvez Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!