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

202
Views
¿Cómo puedo hacer que javascript verifique diferentes valores de un grupo de casillas de verificación?

Tengo un grupo de marcas de verificación HTML que se parece a esto:

 Show: [ ] New [ ] Regulars [ ] Veterans

En mi código javascript, uso Axios para conectarme a una API .Net como esta:

 const fetchGamerTags = async (showNew, showRegulars, showVeterans) => { let apiAddress = ""; if (showNew) { apiAddress = "api/tags/GetNew/" } else if (showRegulars) { apiAddress = "api/tags/GetRegulars/" } else if (showVeterans) { apiAddress = "api/tags/GetVeterans/" } else { apiAddress = "api/tags/GetAll/" } const result = await axios(apiAddress, { params: { isDeleted: false } });

Mi problema es que no sé cómo manejar si un usuario selecciona varias opciones... como Nuevo y Veteranos. ¿Hay alguna manera de manejar eso en mi javascript?

¡Gracias!

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

0

use axios.all para obtener múltiples solicitudes

 const fetchGamerTags = async (showNew, showRegulars, showVeterans) => { let getNew = axios.get("api/tags/GetNew/", {params: {isDeleted: false}}); let getRegulars = axios.get("api/tags/GetRegulars/", {params: {isDeleted: false}}); let getVeterans = axios.get("api/tags/GetVeterans/", {params: {isDeleted: false}}); if(showNew && showRegulars && showVeterans) { const result = await axios.get(apiAddress, { params: { isDeleted: false } }); } else { list = []; if (showNew) { list.push = getNew; } if (showRegulars) { list.push = getRegulars; } if (showVeterans) { list.push = getVeterans; } const result = await axios.all(list, { params: { isDeleted: false } }); } return result; }

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!