Fetch request not working

I have deployed my first app on render. It involves a post request.
I want to be able to make post requests from an external site. How can I do this?
This is the code I am trying to use.
I am getting a 403 error.

    const myComment = document.getElementById("comment");
    const myDisplay = document.getElementById("display");
    const myBtn = document.getElementById("myBtn");

    myBtn.addEventListener("click", sendComment);

    function sendComment() {
        let msg = myComment.value;
        fetch("https://managementapi.onrender.com/comment", {
            mode: "no-cors",
            method: "post",
            body: JSON.stringify({ comment: msg }),
            headers: {
                "Content-Type": "application/json; charset=utf-8"
            .then((response) => {
                if (response.status === 200) {
                    myDisplay.innerText = `We received your comment:\n"${msg}"`;
                } else {
                    myDisplay.innerText = "Something went wrong.";
                    throw Error("Server rejected comment.");
            .catch((err) => console.log(err));


I have done some reading on Stack Overflow and they suggested that the “no-cors” mode won’t help and that I need to use a cors anywhere proxy.

Has anyone else tried this approach? I will try it out later.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.