jQuery XML解析循环 [英] Jquery xml parsing loops
本文介绍了jQuery XML解析循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以推荐执行以下操作的最佳方法吗?
Can anyone recommend the best way to do the following?
我需要一个循环,该循环将遍历前两个xml项并对内容进行处理,然后第二个循环将遍历第3项并进行其他处理?我该如何指定呢?
I need a loop that will loop through the first two xml items and do something with the contents, then a second loop that will loop through items 3 onwards and do something different? How can I specify this?
感谢您的帮助
保罗
推荐答案
只需像往常一样遍历所有项目(使用$.parseXML()
和$.each()
),但是请检查要查看的项目的索引并在那里执行不同的操作.
Just loop through the items as you would normall (using $.parseXML()
and $.each()
), but check for the index of the item you're looking at and perform the different actions there.
例如: http://jsfiddle.net/lukemartin/RsXw9/
http://api.jquery.com/jQuery.parseXML/
这篇关于jQuery XML解析循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文