jquery and xml. Getting nodes as list items -


i trying parse xml , of fine. however, having trouble getting nodes , creating list items. code far

$(xml).find('section1').each(function (i) {    var mylink = $(xml).find('link').text();    $('#set1').find('ul').eq(i).append("<li>"+mylink+"</li>"); }); 

but happens takes of "mylinks" nodes , puts them in 1 <li>. ideas on crating <li> each mylink node?

thanks

maybe need change $(xml) $(this) inside loop?

and fixup append code (you have 1 list, right? if so, remove .eq stuff) this:

var $list = $('#set1').find('ul');  $(xml).find('section1').each(function () {    var mylink = $(this).find('link').text();    $list.append("<li>"+mylink+"</li>"); }); 

if works, might able simplify down this:

var $list = $('#set1').find('ul');  $(xml).find('section1 link').each(function () {    var mylink = $(this).text();    $list.append("<li>"+mylink+"</li>"); }); 

and perhaps further using $.map


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -