xml数据
<?xml version="1.0" encoding="utf-8"?>
<table>
    <node name="node1" >
        <text title="test"  content="详情" />
        <img name="image" />
        <pic name="test.jpg" />
        <pic name="test1.jpg" />
        <pic name="test2.jpg" />
    </node>
    <node name="node2" >
        <text title="test"  content="详情" />
        <img name="image" />
        <pic name="test.jpg" />
        <pic name="test1.jpg" />
        <pic name="test2.jpg" />
    </node>

</table>
 
请求xml
    $.ajax({
                url: './data/'+cityCode+'/lc_contect.xml',
                type: 'GET',
                dataType: 'xml',
                async: false,
                success: function(xml) {
                   //解析xml
                    });
                }
            });
 
解析xml
//遍历
$(xml).find('node').each(function() {
    var fieldObj = $(this);
    var fId = fieldObj.attr("id");//读取节点属性

});
 
原文链接:https://blog.csdn.net/u010177789/article/details/78337225

  

相关文章:

  • 2022-12-23
  • 2021-12-20
  • 2021-07-17
  • 2021-10-19
  • 2022-03-04
  • 2022-01-15
  • 2021-12-25
  • 2021-05-27
猜你喜欢
  • 2022-12-23
  • 2021-12-10
  • 2021-10-17
  • 2021-08-23
  • 2022-12-23
  • 2022-01-02
相关资源
相似解决方案