0

Given the following html form:

<form class = "new-date" method = "POST" action = "http://localhost:5600/postDate">
                <h3>Owner</h3>
                <input type ="text" name = "ownerName" class = "form-element global"  id="owner">
                </select>
                <h3>Pet</h3>
                <input type = "text" name = "petName" class = "form-element global" id = "pet">
                </select>
                <h3>Schedule the date</h3>
                <input type="date" id="birthday" name="birthday" class = "form-element global"  id="date">
                <h3>Description</h3>
                <textarea class = "form-element description-text" placeholder= "What is wrong with your pet?" name ="problem" ></textarea  id="problem"><br>
                <input type="submit" class = "form-element btn" value="Add">
</form>

Im trying to make a post method that is located inside my server.js (Node):

const exp = require('express');
const path = require('path');
var bodyParser  = require('body-parser');
const app = exp();

/*DATABASE AND QUERIES*/ 
const mysql = require("mysql2"); 

var con = mysql.createConnection({
    host: "localhost",
    user: "root",
    password: "admin",
    database: "control_clientes",
    connectionLimit: 5
});

app.use(bodyParser.urlencoded());
app.use(bodyParser.json());

app.post('/postDate', (req, res)=>{
    console.log(req.body.ownerName); //TO CHECK IF IM RECEIVING THE DATA. IT WORKS
});

After submitting and sending the client side data to my server, the html page is not properly doing the reload task:

As can see in this image, the reload thing is still going. I’m not sure why it does that.

Im new to Node JS, do you have any idea what is going on with the unfinished reload thing?

Anonymous Asked question May 13, 2021