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

217
Views
DecodeURI for query parameter in URL does not work

Since the value parameter has characters that are not read, such as the " " where the value is found where it is encountered, I tried to pass in the URL in reference to the decodeURI value but it doesn't work.

Can you kindly help me with this?

<a href="updatebook.html?id=${item.id}&number=${item.number}&value=decodeURI${item.value}">${item.type}</a>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You have 2 problems with your code.

The first is that you are using decodeURI function but you should use encodeURI function.

The second problem is that you are not calling the function, you forgot the ( and ).

Update:

As pointed out by @deceze, the third problem is the function call needs to be inside the ${}.

All put together, it should be:

const item = {
    id: 1,
  value: 'https://stackoverflow.com?q=hello world',
  type: 'bar'
};

let link = `<a href="updatebook.html?id=${item.id}&number=${item.number}&value=${encodeURI(item.value)}">${item.type}</a>`;

console.log(link);

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