In your codepen the link in this line…
const data = await fetch('https://api.countapi.xyz/hit/cdevl-counter/visits')
…produces this information…
504 Gateway Time-out ![]()
Also codepen will be unable to make head or tales of this…
<script src="index.js" defer></script>
This, of course, begs the question; why are you wanting to
use an inferior javascript method when you a have already
been provided with a working PHP one in this post here…