javascript - XML nodes printed twice -


below code:

function widget_itemaddcallback(carousel, first, last, xml) {        jquery('image', xml).each(function(i){           document.write(jquery('url',xml).text())     }); ... }; 

this loops trough xml file send function. xml file build this:

<image>    <url>url1 here</url>    <id>id1 here</id> </image> <image>    <url>url2 here</url>    <id>id2 here</id> </image> 

now when run trough piece of code posted above, url's posted twice each (4 urls in total, should 2). every loop trough 'image' tag post url tags can find in xml under image node. can't seem find how make sure prints url current node. on appreciated!

thanks!

jquery('url',xml).text()  

selects url nodes- write url nodes image nodes.


Comments