A “pure” front end example, like what you linked, only works if you ask the user to login vai Implict Auth in order to make calls to Twitch.
But this generally you don’t want to do, since users don’t want to have to login to use your site first.
Your code doesn’t work because you’re adding &callback=? to the end of it for some reason, which isn’t a valid param and the question mark at the end is malforming the querystring.
Additionally, you’re not sending the v5 header so the endpoint defaults to v3 which doesn’t exist any more and has long since been deprecated (just as v5 will be in the near future as it’s already marked as deprecated, which is why is why you’ve been encouraged to use Helix).
If you logged the body of the response you would have seen error messages indicating all of this