Calling for a function returns 'undefined' [duplicate]
问题 This question already has answers here : How do I return the response from an asynchronous call? (36 answers) Closed 6 years ago . I have a form on my page. When the user hits the Send button, in the background it also generates a unique_number by calling for a function that generates this number and also checks in the DB that this number doesn't exist; if it does - generates it again, if doesn't - returns this number. However, for some reason when I'm trying to print out this number to the