how to convert xml to json using jquery

后端 未结 1 471
轮回少年
轮回少年 2020-12-02 00:24

The following code runs very well for this test XML page:

$.get(\'data/animals.xml\', function(xml){
var animals = $.xml2json(xml);
alert(animals.dog[1].na         


        
相关标签:
1条回答
  • 2020-12-02 00:54

    Try the following. I've tested it on FF 3.6 and Chrome 6, it works.

    $.get('data/eurofxref-daily.xml', function(xml) {
          var jsonObj = $.xml2json(xml);
          alert(jsonObj.Cube.Cube.Cube[0]["rate"]);
    }); 
    
    0 讨论(0)
提交回复
热议问题