Hi All,
I need to call two functions sequentially (means one by one) in javascript on onclick event.
The requirement is to get the data from the backend and then make the cell highlight. Below code snippet is used for this:
cell1.onclick=function() {
getData("FileName");
setTimeout("setHighlight('FileName')", 500);
};
Currently i am using the setTimeout
for calling the second method after a delay of 500ms.
The problem with above code is if getData
method takes more than 500ms to get the data from backend then in that case cell would not get highlighted.
Is there any way to do this?
Thanks Jyoti