Becass,
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
</head>
<body>
<div id="tcena">123</div>
<p id="res"></p>
<p id="res2"></p>
<script>
$(document).ready(function () {
$.ajax({
type: "GET",
async : false,
url: "cb.xml",
dataType: "xml",
success: XmlKurs
});
function XmlKurs (xml) {
$(xml).find("Valute").each(function(){
var atr ='R01239';
if(atr =='R01239') {
var price=$(this).find("Value").text().replace(/,/,'.');
console.log(price);
$("#res").append(document.getElementById('tcena').value()*price);
}
});
}
});
var Euro = new function () {
$(document).ready(function () {
$.ajax({
type: "GET",
async : false,
url: "cb.xml",
dataType: "xml",
success: XmlKurs
});
function XmlKurs (xml) {
$(xml).find("Valute").each(function(){
if($(this).attr('ID')=='R01239') {
var price=$(this).find("Value").text().replace(/,/,'.');
$("res2").append(document.getElementById('Euro').value()*price);
}
});
}
});
};
</script>
</body>
</html>