Skip to content

Instantly share code, notes, and snippets.

@ssaurel

ssaurel/bpi_json.js

Created Dec 12, 2017
Embed
What would you like to do?
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