This is my js file :
window.onload=function(){
var anima = document.getElementById("crypto");
var ret = document.getElementById("btn");
ret.addEventListener("click",function(){
var ourRequest = new XMLHttpRequest() ;
ourRequest.open('GET','https://api.cryptonator.com/api/full/btc-usd');
ourRequest.onload = function(){
var fdata = JSON.parse(ourRequest.responseText);
//renderHTML(fdata);
console.log( fdata);
};
ourRequest.send()
});
When I click on the button the BTC price must be visible in the div area of the hmtl page.
How can I achieve this ? This is the url https://api.cryptonator.com/api/full/btc-usd
The id of the div is crypto.