zoukankan      html  css  js  c++  java
  • 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);
                });
            }   
        });
    }

  • 相关阅读:
    php Windows系统 wamp集成环境下redis的使用
    IO流文件拷贝
    IO流框架
    Map集合
    泛型
    Deque(队列)
    List接口
    Iterator接口(迭代器)
    Java中的异常详解
    Java中的正则表达式
  • 原文地址:https://www.cnblogs.com/zhangfei/p/2871177.html
Copyright © 2011-2022 走看看