0
votes

I need to get today rate for CZK currency from European Central Bank XML -> http://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml

This is my code now

var xml = $.parseXML("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml"),
$xml = $( xml ),
$test = $xml.find('Cube');

console.log($test.text());

and I got an error Uncaught Error: Invalid XML

1
Get the XML file and try to validate it. It may not be valid. - BPS

1 Answers

0
votes

The argument to the parseXml function of JQuery is a string containing the XML document.

So in your example it tries to parse the URL string as XML which apparently fails. To parse the data from the URL load it yourself and then put it into the parseXml function.