I'm currently in the process of working on a webpage with multiple sections. One section includes a form that sends a POST request. Once this form is successfully submitted, I want to update the CSS style of another element to make it visible.
Given that the submit event occurs server-side (using node.js), how can I establish communication between this file and the CSS/HTML? My goal is to avoid sending an entirely new page and simply make slight updates to the existing one.
app.post("/section-2", function(req, res) {
console.log(req.body);
authorizeAndExecute(findOpenDataRow);
res.send("<style>.section-2-next{visibility:visible}</style>")
});
The provided example demonstrates an attempt I made, but it ends up clearing the entire page. I also experimented with jQuery, but it's evident that the server doesn't have the same connection to HTML as a regular JavaScript file does.
EDIT: Here is some of the HTML related to the form and the element whose style I aim to modify:
<form action="/section-2" method="POST">
<button type="submit" class="btn btn-primary btn-lg section-2-submit">Submit</button>
<button class="btn btn-success section-2-next" type="button" name="button">Continue</button>
</form>