I am using a synchronous request in my code to get a value which is needed in the next function for my app to work correctly. The synchronous request is however depreciated therefore should not be used.
$.ajax({type: 'POST',
url: 'ins-id.php',
success: function(data) {
Rsp = JSON.parse(data);
if (Rsp.success) {Key = Rsp.id};
},
async:false
});
The reason given for the depreciation is that synchronous requests cause delays and thus disrupt the user experience.
Thus my question is, what is the prescribed method to retrieve data which is needed for immediate consumption?