2025年云南特岗教师学科精讲课程

jquery解析XML及获取XML节点名称的实现代码
2016-06-27来源:易贤网

2025特岗教师学科精讲课,试看满意购买,配套纸质资料免费包邮!>>

下面小编就为大家带来一篇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);

      });

    }  

  }); 

}

以上这篇jquery解析XML及获取XML节点名称的实现代码就是小编分享给大家的全部内容了,希望能给大家一个参考

2025年云南成考学历提升预报名

2026公务员·事业单位培训课程试听报名

  • 报班类型
  • 姓名
  • 手机号
  • 验证码
推荐信息