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

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

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