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

154
Views
How can i store / pass the data after an api call?

I have a simple problem which wish someone can shed some light on. After I call an external api returning JSON object. I cannot pass the response outside the callback function. and It returns undefined.


let params = {
   key: "value"
  };

function callback (data) {
    return data
}

//calling the external api which return json object
search.json(params, callback);

no matter how i try to store the data it returns undefined except inside the call back function.

my problem is how can i pass the data to a global scope or access the response after i calling the function though import module.

thanks

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!