I have a node.js website that i build with this tutorial: https://scotch.io/tutorials/easy-node-authentication-setup-and-local
I update some data in routes.js and than redirect to one of my views (.ejs):
app.post('/setScore', isLoggedIn, function (req, res) {
Real.find({'_id': req.body.realID}).exec(function (err, real) {
real.forEach(function (real1) {
real1.local.scoreH = req.body.home;
real1.local.scoreA = req.body.away;
real1.save(function (err) {
if (err)
throw err;
})
})
}); ......
//....
res.render('league.ejs', {
});
the page don't show the data that i had updated. only after i refresh the page the updated data is shown.
how can i solve it so the data will shown on page right after redirecting?
via Doron
No comments:
Post a Comment