Why doesnt my website sub url working when submitting form but works when i manually enter it

I have a form on localhost:8080 which when you enter form data (user & pass), then press submit, it meant to send a POST to localhost:8080/submit, then should show text on that page saying “Submit page”. When I enter “localhost:8080/submit” into my browser, it works, but when I use the submit button to get there, it says “This site can’t provide a secure connection” (aka, doesn’t work)


const url = "https://localhost:8080";
const data = {
    "user": "user",
    "pass": "pass"

function send() {
    $.post(url, data, function (data, status) {
        console.log("Sent " + data + ", status is: " + status)
body {
    background-color: #444444;

.form-div {
    width: 100%;
    height: auto;
    text-align: center;
    justify-content: center;
    align-content: center;
    border: 1px solid red;

form {
    color: white;
<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <title>Harley Swift</title>
    <link rel='stylesheet' href='styles.css'/>
    <script type="text/javascript" src="script.js"></script>

<div class="form-div">
    <form method="POST" action="https://localhost:8080/submit">
            <label for="user">Username</label>
            <input name="user" type="text" id="user"><br>

            <label for="pass">Password</label>
            <input name="pass" type="password" id="pass"><br>
            <button class="btn" onclick="send()">Submit</button>

app.js: https://hastebin.com/udunalurub.lua (couldn’t figure out how to use code snippets on here, sorry)

Thank you in advance! I am not too familiar with nodejs servers yet


Don’t use https, use http when developing locally.