使用Jquery从XML填充列表框 [英] Populate listbox from XML using Jquery

查看:65
本文介绍了使用Jquery从XML填充列表框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,谁能告诉我如何使用xml填充列表框,我的XML很大,并且希望在列表框中填充垂直节点.
请帮助我,我真的被这打动了.

Hello everyone can anyone tell me how can i populate a listbox using xml, i have a very big XML and I want a listbox to be populated with a perticular node.
Please help me i am really struck over here.

推荐答案



首先,您必须拥有xml文档,并且必须在列表框中右显示数据.

您的xml文档具有类似
的格式
Hi ,

first of all you''ve xml document and u''ve to display dat data in listbox right.

your xml document have format like
<usernames><username>murali</username><username>krishna</username><username>chinna</username><username>ashok</username></usernames>



这里的用户名是根元素,用户名是重复元素.

您想要在列表框右侧显示用户名元素数据.

我们可以使用不带backcode的jquery来实现这一目标



here usernames is a root element and username is repeated element.

you want to display username elements data in listbox right.

we can achieve this by using jquery without backcode

Jquery.get("sample.xml",{},function(data){


(数据).find(" 用户名").each( 功能(){ listbox.add(
(data).find("username").each( function(){ listbox.add(


( this ).text()); }); }," );
(this).text()); }); },"xml");



在这里您必须提及



here you must mention the return type of


这篇关于使用Jquery从XML填充列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆