Thursday, July 30, 2009

How to make a process to wait until a function return a value in java script?

Hi, can anyone tell me, How to make a process to wait until a function return a value in java script?





Example of my code,





function A1()


{


var cl;


cl = activity.clsWebRef();


alert("Hai");


}





Note: Here activity.clsWebRef() is class function call. Im calling a function inside a class from Java script. Pbm is 'Before executing the function call that alert msg "Hai" gets display. In my code instead of using alert, im assigning that cl value to some condition. Before executing that function call, cl trying to assign values to that condition (it is wrong, its always empty without the function call return value), so i want to delay the process, that means i want to make the process like this, " That alert msg has to display after the function return a value. Is it possible to do like that?





" I think you get my point that what im trying to ask"





Can u give me a solution?

How to make a process to wait until a function return a value in java script?
You might try looping until the value is returned, like:





Do until cl %26lt;%26gt; NULL


Loop





Be careful not to create and endless loop if no value is returned


No comments:

Post a Comment