How do we dynamically redirect back to the same page after delete request.
Request link:
The request link which appears in many pages.
<a href="/delete/id">delete</a>
route.js
router.get('/delete/:id', function (req, res, next) {
// deleting logic here
res.redirect('/to/requesting/page');
});
where /to/resquesting/page
is the url to the page that has requested deletion:
- If
/delete/:id
has been requested from Homepage, we would callres.redirect('/home');
- If
/delete/:id
has been requested from Product, we would callres.redirect('/product);
via NERDYLIZARD
No comments:
Post a Comment