jquery解析XML及获取XML节点名称
jquery获取XML节点名称的几种方法以:
-
get(0).tagName
$(this).get(0).tagName
-
[0].tagName[0]
$(this)[0].tagName
-
context.nodeName
$(this).context.nodeName
function getXMLData(){
$.ajax({
url:'data.xml',
type: 'GET',
dataType: 'xml',
timeout: 1000,
error: function(xml){
alert('Error loading XML document'+xml);
},
success: function(xml){
$("data",xml).children().each(function(){
alert($(this).context.nodeName);
});
}
});
}
点亮测试人生!QQ:408129370
百度阅读电子书地址:http://yuedu.baidu.com/ebook/f6dbb2a2f01dc281e53af0f3
讨论QQ群:536192476
个人公众号:
百度阅读电子书地址:http://yuedu.baidu.com/ebook/f6dbb2a2f01dc281e53af0f3
讨论QQ群:536192476
个人公众号: