Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
function startRefresh() {
    // This is the API URL
    var turl = 'https://btc-e.com/api/2/ltc_btc/ticker';
    // This sends the API URL through Yahoo?
    $.getJSON('https://btc-e.com/api/2/ltc_btc/ticker' + encodeURIComponent(turl) + '%22&format=json', function (data) {
        // Writes to the page 
        $('#ticker').html(data['query'].results.ticker.last+' BTC');
    });
}
// Do the initial pull
startRefresh();
// Refresh every 10000
setInterval(startRefresh, 10000);
 
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $.getJSON("http://whateverorigin.org/get?url=" + encodeURIComponent("https://btc-e.com/api/2/ltc_usd/ticker") + "&callback=?", function(data){
            $("#LTCPrice").append("<center>LTC: $" + $.parseJSON(data.contents)["ticker"]["last"].toFixed(2) + "</center>")
    })
    })
</script>
<div id="LTCPrice" style="height:40px;margin:auto;position:absolute;top:-20;left:0;bottom:0;right:0" />
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers