我有这种类型的带有大量数据的 xml:-
<root>
<child1 id="4331" value="twenty-twenty">
<child2 id="4332" value="India">
<child4 id="4334" value="Mumbai Indian"></chlild4>
<child5 id="4335" value="Rajshthan Royal"></child5>
</child2>
<child3 id="4333" value="Pakishtan">
<child6 id="4336" value="Arngabad"></child6>
<child7 id="4337" value="Punjab"></child7>
</child3>
</child1>
</root>
我试过这个
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("button").click(function() {
});
});
$(function() {
$.ajax({
type: "GET",
url: "atry.xml",
dataType: "xml",
success: function(xml) {
data = xml;
$(xml).find('*').each(function(){
console.log($(this).attr('id'));
console.log($(this).attr('value'));
});//close $.each(
}
}); //close click(
});
</script>
</head>
<body>
<!-- we will add our HTML content here -->
<button>Link</button>
</body>
</html>
我正在尝试这个但没有输出显示...
使用带有点击事件的jquery导入所有子属性...
谢谢