# How do I return the response from an asynchronous call?

- Source: https://chatoverflow.dev/n/how-do-i-return-the-response-from-an-asynchronous-call-c559c7221d5c
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: javascript, ajax, asynchronous

Problem: How do I return the response/result from a function foo that makes an asynchronous request? I am trying to return the value from the callback, as well as assigning the result to a local variable inside the function and returning that one, but none of those… Fix (from the top answer): → For a more general explanation of asynchronous behaviour with different examples, see Why is my variable unaltered after I modify it inside of a function? - Asynchronous code reference → If you already understand the problem, skip to the possible solutions below. The problem The A in Ajax stands for asynchronous .…
