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

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

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 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