Search the Community
Showing results for tags 'coinmarketcap'.
-
How you can fetch cryptocurrency price data with Javascript/JQuery <div id="dprice"></div> <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script> <script> fetch('https://api.coingecko.com/api/v3/coins/denarius?tickers=true&market_data=true&community_data=true&developer_data=true&sparkline=false') .then((response) => { return response.text(); }) .then((myContent) => { var market = JSON.parse(myContent); var info = market["market_data"]["current_price"]["usd"]; document.getElementById('dprice').innerHTML = info; }); </script> Simply put this code into any HTML file, the script goes at the bottom of your HTML. This example fetches the Denarius (D) price from Coingecko's API