好的,所以我很欣赏Javascript不是C#或PHP,但我一直回到Javascript中的一个问题 - 不是JS本身,而是我使用它.
我有一个功能:
function updateStatuses(){
showLoader() //show the 'loader.gif' in the UI
updateStatus('cron1'); //performs an ajax request to get the status of something
updateStatus('cron2');
updateStatus('cron3');
updateStatus('cronEmail');
updateStatus('cronHourly');
updateStatus('cronDaily');
hideLoader(); //hide the 'loader.gif' in the UI
}
Run Code Online (Sandbox Code Playgroud)
事实上,由于Javascript强烈希望在代码中跳跃,加载器永远不会出现,因为'hideLoader'函数直接运行.
我怎样才能解决这个问题?或者换句话说,如何按照我在页面上写的顺序执行javascript函数...