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

96
Views
solicitud asíncrona a través de jquery $.get()

Cuando estoy usando el siguiente código, la salida no está undefined

 const getData = async() => { $.get("foo", (data) => { return data; }) } (async () => { const d = await getData(); console.log(d); })();

El sitio http://127.0.0.1:5000/foo es un archivo json.

Pero si estoy usando el siguiente código, obtengo el archivo json.

 (async () => { const getData = await $.get( "foo", (data) => { return data; }); console.log(getData); })();

¿Por qué el primero no da la salida adecuada?

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

0

Parece que olvidaste un retorno en tu función.

 const getData = async() => { return $.get("foo", (data) => { return data; }) }
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!