[jQuery] Convert xml tree to ordered list with jQuery
Hello
I've got an external xml file like this:
<items>
<item>1</item>
<item>2
<item>2.1</item>
<item>2.2/</item>
</item>
<item>3
<item>3.1</item>
</item>
</item>
Now, how would I make this into a nice ordered list like this with
jQuery:
<ol>
<li>1</li>
<li>2
<ol><li>2.1</li><li>2.2</li><li>2.3</li></ol>
</li>
<li>3
<ol><li>3.1</li></ol>
</li>
</ol>
My starting code looks something like this:
$(document).ready(function() {
$.get("whatever.xml", function(data){
$("item", data).each(function(){
});
});
});