[jQuery] dynamic tree / treeview

[jQuery] dynamic tree / treeview


Hi
I am using jquery to create tree structure type of functionality
dynamically. I have to add nodes by opening dialog and save it into
the database. Once response is returned then I need to show it on the
page. I have few doubts here:
1) Once node is inserted into the database and response is rendered on
the page then how can I fetch id/value of the node. Here, DOM
shouldn't be updated automatically? I am not able to fetch parent node
id while adding child into it.
2) Once data is rendered on the page and if I refresh it then how
should I show the tree which was already created dynamically? Do I
need to bring all the data from the database by passing parentid?
Please guide.
Thanks,
Bhavin