I am using mongoose as my back end and I am sending an xhr request(post) to my server in which the field values are sent like in the screen-shot below
This is my server code ,when i try to console my values it shows empty even i send the values.Can anyone please help me.Thanks in advance.
exports.addTest = function (req, res) {
var params = req.params;
var body = req.body;
console.log(JSON.stringify(params, null, 4));
console.log(JSON.stringify(body, null, 4));
var blogsModel = new blogs(params);
blogsModel.save(function (err, results) {
if (err) {
return console.error(err);
}
res.json(results);
});
};
via MMR
No comments:
Post a Comment