problem with dynamic tree construction from database

Hi friends,

Actually i am trying to construct a tree by retrieving values from database. after selecting a node it event listener is going to call and another query is going to fire and those values should update in the tree. but problem is the query is fired successfully but i am not able to display the records in the frontend. please help me asap.

first it has to populate all the list of continents from DB and then after click on the particular continent it has to show the countries in the DB in tree format. i am able to display the continents but not getting the country values. (* i hope you got the things).