Click here to Skip to main content
15,917,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI..
JavaScript
function test()
{
       first();
       second();
       third();

}
 function first(){}
 function second(){}
 function third(){}

I have this type of situation in my code. Now, many time function three is called before first and second complete execution.

I want third to wait until first and second finish execution, don't want to use delay.
Posted
Updated 28-Dec-10 1:40am
v2

1 solution

I want third to wait until first and second finish execution, don't want to use delay.
Here:
JavaScript
function test()
{       
   first();       
   second();       
   third();
}

By default, it is always synchronous. Thus, third would only be executed after first finishes and then second finishes.

Thus, no need to use any wait/delay.
 
Share this answer
 
Comments
niravsahayata 28-Dec-10 7:49am    
$('#imageDiv').hide();
$('#frameID').show();
ScrollTop();

i have this code and ScrollTop(); is always execute before first two events

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900