Reputation:
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.
Upvotes: 1
Views: 704
Reputation: 3135
use res.redirect
io.on('connection', function(socket){
socket.on('query', function(qCity,qState,qLowPrice,qHighPrice, req, res){
res.redirect('http://yourdomain.com/result')
});
Upvotes: 6
Reputation: 3824
You should just be able to use redirect in express like this:
res.redirect('your/path.html');
Upvotes: 3