Good morning
I tried to create a small js script for a visit counter and it doesn’t work.
Do you have an idea?
Good morning
I tried to create a small js script for a visit counter and it doesn’t work.
Do you have an idea?
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…
In the tutorial it does this and it works and for me it doesn’t.
Perhaps you could supply a link to your tutorial.
This, at least, will enable members here to
compare it with your codepen version.
here is the link
the API server’s dead.
Not much you can do about that if you really want to use that service.
FWIW, a dedicated endpoint (external or not) requested from the client side can be useful if you are caching the page responses, where the BE code wouldn’t get executed for each request.