asynchronous loading

I’m using a dhtmlxgrid with a column of type “tree”. I’m using dhtmlx version 3.0.
I’m using dhtmlxgrid built-in loop to iterate on rows and load each node sub-items asynchronously.
dhtmlxAjax.get(“”+id, function(){ //1st statement
grid.parse(rowData); //2nd statement

This code snippet doesn’t work very well, and I think it’s because of async loading (although sometimes it works well).
I have two questions :
1 - Is there any way to know when 1st statement has finished loading data so that I can call 2nd statement safely?
2 - Since I’m calling server side code in a loop, how can I be sure data loaded in 1st statement will be parsed for the right row id in second statement(data are loaded asynchronously)?

According to your code the parse() method is called from a callback function of dhtmlxAjax get() method.
So the operation should work correctly.
If issue still occurs for you - please, provide a more detailed sample of your code.