I need to perform this step:-
- When document is ready,
- do function A,
- After function A is completed,
- perform function B, C, D
Though not exactly the answer, the following way works:-
<script>
$(document).ready(function(){
function_a();
setTimeout(function(){
function_b();
function_c();
function_d();
}, 100);
});
</script>
Surely, I cannot always depend on time delay! However, the following way is not working:-
<script>
$(document).ready(function(){
function_a();
}).complete(function(){
function_b();
function_c();
function_d();
});
</script>
How can the second way be improved?