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

392
Views
Access query parameters using axios

I am using React in the frontend and Django in the backend and I am currently doing the API integration for which I am using Axios.

So in the frontend side I am calling a URL like this

http://localhost:3000/attempt/?quiz_id=6

and I want the quiz_id = 6 so that I can use this afterward to access data in the backend.

I am using Functional components if that helps.

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

0

You can take a look at axios's documentation in github

If what you want to do is a GET request this should be enough:

axios.get('http://localhost:3000/attempt/?quiz_id=6')
  .then((res) => {
    // handle success
    console.log(res);
  })

Also you have available this kind of usage:

axios.get('http://localhost:3000/attempt', {
  params: {
    quiz_id: 6
  }
}).then((res) => {
   // handle success
   console.log(res);
  });
about 4 years ago · Juan Pablo Isaza Report

0

You can use this too:

const data =  await axios.get('http://localhost:3000/attempt/?quiz_id=6').then(res => res.data);
about 4 years ago · Juan Pablo Isaza Report

0

You can include dynamic quiz_id by using params. The way for this is to making an axios request using the id of the param that you want to update and return:

Your code will read like so:

axios.get('http://localhost:3000/attempt/${quiz_id}', quiz_id);
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!