We have a requirement where we want to make ajax call async = true instead false so that it doesn't block other js, but at the same time we have some js files which are dependent on ajax call success object(using property of that object) - So what would be the best approach/design pattern to implement this
Ajax Call will execute first
$.ajax({
url: 'someEndPoint',
async: true,
success: function (result) {
window.abc = {};
result = result.model;
if (result != undefined) {
window.abc = result.model;
}
}
});
other.js Should wait for abc object to get populated
if(abc.someProperty){
//Do some work
}