最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - how to convert xml to json using jquery - Stack Overflow

programmeradmin4浏览0评论

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].name +'/'+ animals.dog[1]);
});

But how can I adapt this code to get the rate data from this European Central Bank page?


Reference:

  • getting data using javascript

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].name +'/'+ animals.dog[1]);
});

But how can I adapt this code to get the rate data from this European Central Bank page?


Reference:

  • http://www.fyneworks./jquery/xml-to-json/#tab-Usage
  • getting data using javascript
Share Improve this question edited May 23, 2017 at 12:09 CommunityBot 11 silver badge asked Sep 4, 2010 at 15:06 Bilgin KılıçBilgin Kılıç 9,11915 gold badges44 silver badges69 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 12

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)

  1. 暂无评论