Анонс статьи блога под длинным заголовком
Снова про курс валют Центробанка, про cross-origin и джаваскрипты
,
также эти самые скрипты: финальный, и... еще один:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.js"></script>
<script>
$(document).ready(
function(){
$.getJSON("https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D'http%3A%2F%2Fwww.cbr.ru%2Fscripts%2FXML_daily.asp%3F'&format=json&callback=")
.done(
function(data){
var output = '<ul>';
$(data.query.results.ValCurs.Valute).each(function(i, item){
output += '<li>' + item.Name + ' - ' + item.Value + '</li>';
}
);
output += '</ul>';
$('#test').append($(output));
}
)
}
);
</script>
<div id="test" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<link href="../style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.js"></script>
<script>
$(document).ready(function () {
$.ajax({
type: "GET",
url: "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D'http%3A%2F%2Fwww.cbr.ru%2Fscripts%2FXML_daily.asp%3F'&diagnostics=true",
dataType: "xml",
success: xmlParser
});
});
function xmlParser(xml) {
$('#load').fadeOut();
$(xml).find("Valute").each(function () {
$(".main").append('<div class="exchange_rate"><div class="title">' + '</div><div class="description">' + $(this).find("Name").text() + '</div><div class="date">Стоимость ' + $(this).find("Value").text() + '</div></div>');
$(".exchange_rate").fadeIn(1000);
});
}
</script>
<style>
.main{
width:1000px;
margin:0 auto;
height:130px;
}
.exchange_rate{
width:208px;
float:left;
margin:10px;
border:1px #dedede solid;
padding:5px;
display:none;
}
.title{
margin-bottom:6px;}
.description{font-size:11px; font-family:Geneva, Arial, Helvetica, sans-serif;}
.date{font-size:10px; color:#999; margin-top:4px;}
.loader{
height:11px;
}
</style>
</head>
<body>
<div class="main">
<div align="center" class="loader"><img src="loader.gif" id="load" width="16" height="11" align="absmiddle"/></div>
</div>
<div class="clear"></div>
</body>
</html>