Skip to content

Instantly share code, notes, and snippets.

@ssaurel
Created December 12, 2017 10:52
Show Gist options
  • Save ssaurel/0fd2227e99fea8fb8bbe67aabdd0095b to your computer and use it in GitHub Desktop.
Save ssaurel/0fd2227e99fea8fb8bbe67aabdd0095b to your computer and use it in GitHub Desktop.
Bitcoin Price Index Watcher in HTML5 Tutorial Step 3
function parseJson(json) {
var time = "<b>Last Updated : " + json["time"]["updated"] + "</b>";
var usdValue = "1 BTC equals to $" + json["bpi"]["USD"]["rate"];
var gbpValue = "1 BTC equals to &pound;" + json["bpi"]["GBP"]["rate"];
var euroValue = "1 BTC equals to &euro;" + json["bpi"]["EUR"]["rate"];
document.getElementById("data").innerHTML =
time + "<br /><br />" + usdValue + "<br />" + gbpValue + "<br />" + euroValue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment