I have used my node.js
method getDetails
and provide one static id. But data results as object. When I check my node.js
method from postman it provide JSON string but AJAX successful data is provide object dont no why??
$.post("/salons/getDetails",
{
objectId: "561cd801a4b2b6ec1dafba23"
},
function(data)
{
alert(1);
alert(data);
});
});
My backend method is
router.post('/getDetails',function(req,res){
data=req.body;
var objectId=data.objectId;
salon.find({ "_id": objectId }).exec(function(err, data) {
if (err) throw err;
res.json(data);
});