window.addEventListener("load", () => { const comments = document.querySelector(".comments"); const id = new URLSearchParams(document.location.search).get("v"); comments.innerText = "Loading..."; fetch("/comments.shs?v=" + id).then( res => { if (res.status !== 200) { throw new Error('HTTP Error ' + res.status); } return res.text(); } ).then( res => comments.innerHTML = res ).catch( err => comments.innerText = 'Error during fetching comments: ' + err.message ) })