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

157
Views
Comparando contra un valor dinámico en un JSON

Tengo la siguiente matriz JSON:

 [ { "Alpha": {"min": "1", "max": "2"} }, { "Beta": {"min": "10", "max": "20"} }]

El plan es que el usuario seleccione Alpha o Beta, y luego puede seleccionar cuántas unidades necesita.

 var selectedUnit = $("#entry_field").val(); $.getJSON("/json-url/", function(data) { var a = data[0].Alpha.min; // This works var b = data[0].selectedUnit.min // This does not work, and I'm not sure why var c = data[0].Beta.min; // This does not work, but I understand why var d = data.Alpha.min; // This does not work, and I'm not sure why var e = data.selectedUnit.min; // This does not work, and is going to be what I need if (e > selectedValue) { alert("You are below the minimum units"); } });

Soy consciente de que hay varias cosas que me impiden establecer var e correctamente, pero no estoy seguro de cuál es la mejor manera de establecer este valor.

about 4 years ago · Juan Pablo Isaza
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!