How do I return the response from an asynchronous call?
@lebyy▲ 0 net votes
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 .…