EasyUI Forum
April 24, 2024, 09:24:32 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: JavaScript callback  (Read 9841 times)
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« on: July 29, 2013, 11:02:07 AM »

Hello all
I have this code:

function  myfunc()
{
  func1();
  func2();
  func3(); 
}

I need that func2 run after func1 finished, and func3 should run when func2 is finished.
They are executed as 1,2,3 but they are not finished on that order (for example, func2 is slow and it is not returned, but func3 is already executed.
Question is - how to run those functions so that I'm sure that next function is executed only when previous function is finished?

Thanks.
Logged
chrwei
Full Member
***
Posts: 219


View Profile Email
« Reply #1 on: August 15, 2013, 08:34:50 AM »

that depends on what's happening inside those functions.  if they are async calls of some sort (ajax, timers) then you need to handle that somehow so that the function does not return until its work is complete.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!