I am using express and node.js to run a website. I have anchor elements on each page that refer back to the get function and render the page I am asking for. However, I am making changes to one of the pages, where I add a row to a table and change the innerHTML. Whenever I press on the anchor links to go to another page and then press the anchor link to return, the page resets and the new rows added go away. Is there a way to prevent this?
const express = require('express');
const app = express();
app.use(express.static('public'));
app.use(express.urlencoded({extended: false}));
app.use('/css', express.static(__dirname + 'public/css'));
app.set('view-engine', 'ejs');
app.get("/", (req, res) => {
res.render("index.ejs");
} );
app.get("/dashboard", (req, res) => {
res.render("dashboard.ejs");
} );
app.get("/history", (req, res) => {
res.render("history.ejs");
} );
I tried a few things like preventDefault() in some spots but it didn't work.