Adding elements to HTML list using jQuery
Hi,
I fetch data from a PHP script through jQuery and want to create a HTML list.
This data contains the name of a node and a timestamp
I want the list to have the following structure:
- Node1:
1) timestamp1_1
2) timestamp1_2
-Node2:
1) timestamp2_1
2) timestamp2_2
etc
Basically, whenever I fetch the data and the node is already in the list then just add the retrieved timestamp as a "sublist" item.
If the node is not in the list create the item and list the retrieved timestamp as a sublist.
I am kind of stuck on how to do this, I only have the following so far:
- $("<li>")
.html(location.institute)
.click(function(){
map.panTo(marker.getPosition());
})
.appendTo("#list");
This obviously only creates the "outer" list. Not sure on how to tackle this. Any help is much appreciated.
Thanks in advance.