I have a function that runs on a click, I want this click to redirect to a other view. like a simple link.
how can I render a new view onclick?
node
router.post('/shareinsight', function(req, res, next) {
console.dir(req.body)
var db = req.db_login;
console.log('fs' + req.body.date)
res.redirect('contact');
});
I can see the log in the console so I know that the function is running but it doesn't change view
Try to use this code:
router.post('/shareinsight', function(req, res, next) {
console.dir(req.body)
var db = req.db_login;
console.log('fs' + req.body.date)
res.writeHead(302, {
'Location': 'url'
});
res.end();
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.