How do I return the response from an asynchronous call in Javascript