I am using Express.js in my project. When I submit a form, a function is executed and what I would like is that at the end of the function, it changes the page from index to results.
io.on('connection', function(socket){
socket.on('query', function(qCity,qState,qLowPrice,qHighPrice, req, res){
I want it to redirect here:
}); // end of socket.on query function
}); // end of io.on
I've read on some posts about using middleware but still not sure it's exactly what I want.
use res.redirect
io.on('connection', function(socket){
socket.on('query', function(qCity,qState,qLowPrice,qHighPrice, req, res){
res.redirect('http://yourdomain.com/result')
});
您应该可以像这样在express中使用重定向:
res.redirect('your/path.html');
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.