All I need to do is to execute a callback function when my current function execution ends.
function LoadData() { alert(\'The data has been loaded\');
function loadData(callback) { //execute other requirement if(callback && typeof callback == "function"){ callback(); } } loadData(function(){ //execute callback });