Jump to content

settimeout call multiple functions after a dealy not working?


sayedsohail

Recommended Posts

Hi everyone,

 

I am working on a settimeout function, where i can call functions in serialized form.

 

i.e, execute function 1 and after that execute 2 function .... so on.

 

here is my code, it just performing parallel way, i wish to perform in serial way.

 

var timer = null;
var delay = 500;
function startTimerGet(a)
{
window.clearTimeout(timer);

// function 1
timer=window.setTimeout('MyAjaxRequest()',delay);

// execute function 2 after completion of function 1 one or atleast after a small delay of function 1.

removeinner('titlegrid');

// execute function 3 after completion of function 2 one or atleast after a small delay of function 2.

refreshparentdiv();

}

Link to comment
Share on other sites

i was able to worked it out in way, by adding function 2 next to function1, but this is not exactly i want i wish to send each function after a the set of delay.

 

timer=window.setTimeout('function1(); function2();',delay);

The other method,  am I close but somewhere lost?

 

var counter = 1;
function delayedCall(){
this["function"+counter++]();
if(counter<4){
	setTimeout("delayedCall()", 1000);
}
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.