Home >Web Front-end >JS Tutorial >Summary of methods and differences between synchronous and asynchronous processing in js_javascript skills
When using asynchronous requests, sometimes it is necessary to return the result of the asynchronous request to another js function. In this case, the request result will not be returned until the asynchronous request is returned. The js function where the request is sent has completed the subsequent operations, that is, the return has been executed. , which will cause the return result to be a null character.
Summary: To process the results returned by a send request after using an ajax request, it is best to use a synchronous request.
For example: In the following example, the return result will be incorrect because the ajax asynchronous request has not been executed yet and the function has already executed return.