好的,我理解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
}
问题在于,由于JavaScript热切地希望在代码中跳转,因此加载程序从未出现,因为“hideLoader”函数紧随其后运行。
我该如何解决这个问题?换句话说,我如何使JavaScript函数按照我在页面上编写的顺序执行...