Jump to content

Recommended Posts

Posted (edited)

Good day administrator

How to load asynchronous data from the server.

I have some handy code which is javascript.

I need sample php code to combine it

const getBitcoinPrice = async () => {
const response = await fetch('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd');
const data = await response.json();
const price = data.bitcoin.usd;
document.getElementById("btcusd").innerHTML = "Bitcoin:  " + "$" + price;
}
getBitcoinPrice();
function delBtc() {
    window.location = "delete.php";
}
</script>

 

 

Thanks in advance.

Edited by Chikwado

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...