Given that a "native" synchronous ajax call can block the user interface of the browser, it may not be suitable for many real-world scenarios (including mine).
I am curious to know if there is a way to mimic a synchronous (blocking) ajax call using an asynchronous (non-blocking) ajax call, while still achieving the result of a synchronous call without affecting UI performance.
The concept is illustrated in the following code snippet:
function do_synchronous_ajax_call(url){
// Executes an asynchronous ajax call, which does not interrupt the user interface, but pauses the current script execution
}
var xyz = do_synchronous_ajax_call("http://...."); // Call blocks until the internal ajax request completes
// Process `xyz` here
In essence, the goal is to create a form of "artificially" synchronous ajax call that doesn't impact UI performance.
Although JavaScript lacks multi-threading support, I am still interested in exploring this possibility.
This marks the third inquiry on this topic.
My previous questions are as follows:
how to block on ajax call (I want it to block)
can a synchronous (blocking) ajax call block the browser's UI?