Created
August 2, 2022 20:57
-
-
Save thisiskeanyvy/d7d99e33af8c92fc66c14c015515152a to your computer and use it in GitHub Desktop.
API Bitcoin Price (coindesk)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getBitcoinPrice() { | |
//make a request to the api | |
$.ajax({ | |
url: "https://api.coindesk.com/v1/bpi/currentprice.json", | |
success: function(data) { | |
//parse the data | |
var bitcoinPrice = data.bpi.USD.rate; | |
//display the data | |
$("#bitcoin-price").html(bitcoinPrice); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment