After my form posts, the page refreshes. However I can't seem how to return back to localhost:8080, rather than what is seen in the picture below. I would like after the page is done posting to return to http://localhost:8080/Manager.
Manager Access HTML
<div class='form-group'>
<form id="signin-form" method="POST" action="/upcset">
<input name="AcceptedUPC" type="text" autofocus autocomplete="off">
<button id="upcSubmit" type="submit">Submit</button>
</form>
</div>
Manager Access JS
$('document').ready(function(){
$.get('upcs', (data) => {
data.forEach(element => {
$('#upcList').append('<li>' + element.AcceptedUPC + '</li>');
console.log('<li>' + element.AcceptedUPC + '</li>');
});
});
});
Server.js
app.get('/upcs', (req,res) => {
//get current list from DB
});
app.post('/upcset', urlencodedParser, (req,res) => {
var acceptedupc = req.body.AcceptedUPC;
//insert into DB etc
res.sendFile(path.join(__dirname + '/ManagerAccess.html'));
});

Aucun commentaire:
Enregistrer un commentaire