Good day to all! I'm trying to solve this problem for the 4th day (apparently my knowledge of js is still not enough)
So what we have is such a code ...
$.ajax({ type: "GET", async: false, url: "cb.xml", dataType: "xml", success: currencyRate }); function currencyRate(xml) { $(xml).find("Valute").each(function() { var currencyID = $(this).attr('ID'); //ID валюты var currencyValue = $(this).find("Value").text().replace(',', '.'); //курс валюты console.log(currencyID); console.log(currencyValue); }); }; <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> The code parses the xml file, (link if anything to XML ) pulls out the current exchange rate from it. What I need to do, I need to create an object, by type ...
var currency = { R01775: /*ID валюты*/ '70.3548', /*курс валюты*/ R01760: /*ID валюты*/ '15.0177', /*курс валюты*/ // итд... }; or such a CharCode object: 'Value'
And then we should work with this object ...