Why does my node.js app fail to interact with the back-end on Cpanel when i make a request

Viewed 21

Client-Side Code:

       $.ajax({
            url: '/testdb',
            method: 'POST',
            contentType: 'application/json',
            data: JSON.stringify({
                mssg: "idea"
            }),
        success: ({mssg}) => {
            if(mssg === true){
                
                //location.replace(document.referrer);
                    alert("success")
                //var readerId = document.querySelector(".checkProfile").innerHTML.replace(/\s/g, '');

                //location.assign('index');
            }else{
                alert("failure")
            }
        }

        })

this is the client code when making request. But the server code does not receive the request on cpanel, and i am sure it works on localhost.

Server-Side Code

router.post("/testdb", parser, test);
0 Answers
Related