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

271
Vistas
Vue Axios query string escaping special characters

I am facing a problem with Axios GET query string parameter when string includes "+" or "&" signs. I have tried using encodeURIComponent and I get

http://localhost:8001/api/data?page=1&paginate=20&term=S%2BM%20Company

When trying to query for S+M Company which is located as a value in the database table. Trying to query just a string without encoding it breaks after

http://localhost:8001/api/data?page=1&paginate=20&term=S+M.

The string is added to url from plain text field and the var is

url = url + &term=${this.search}

Any suggestions would be highly appreciated. Thanks!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

There is a built in helper for that:

https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/URLSearchParams

Use it like:

const data = {
  queryOne: 'value1',
  queryTwo: 'value2'
};

const myParams = new URLSearchParams(data);
myParams.toString()
about 4 years ago · Juan Pablo Isaza 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