I would like to ask a rather simple question. I have a jQuery code which fetches the price of a bitcoin jSON API and return its current price in euros. What I would like to do is convert it to lets say any other currency like Danish Crown or anything else. So all in all what i would like to ask is is it possible to multiply the #ticker somehow? Thank you for all of your help!

$(function () {
    startRefresh();
});

function startRefresh() {
    setTimeout(startRefresh, 10000);

    var turl = 'https://btc-e.com/api/2/btc_eur/ticker';

    $.getJSON('http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20json%20where%20url%3D%22' + encodeURIComponent(turl) + '%22&format=json', function (data) {
        jQuery('#ticker').html(data['query'].results.ticker.last);
        jQuery('#ticker').append(' EUR/BTC');
    });
}
有帮助吗?

解决方案

use parseInt(data['query'].results.ticker.last*whatever you want to multiply with)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top