Reputation: 37
in Sails.js, I am trying to pass the role/mentor key/value pair to be received by the contoller function '/select'
VIEW.ejs
...
$.post( '/select', {role: 'mentor'} );
...
CONTROLLER
select: function(req, res) {
var printRole = req.param('role');
return res.send("The role is: " + printRole);
}
So far the result I receive on the screen is : The role is Undefined please help
Upvotes: 1
Views: 809
Reputation: 2558
I think param should be plural as in var printRole = req.params('role')
Upvotes: 1