我已經使用我的node.js
方法getDetails
並提供一個靜態ID。但數據結果作爲對象。當我檢查我的郵遞員node.js
方法它提供JSON字符串,但AJAX成功的數據提供對象不不爲什麼?AJAX成功重定向,但給[object:object]
$.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) {
\t \t if (err) throw err;
\t \t res.json(data);
\t \t });
感謝您對我的工作 –
對不起,你的鍵盤上的'E'有問題嗎?首先「objact」,現在這個。 –
沒有它的不是,但是objact是由於錯誤而急於輸入,因爲它是我的第一個堆棧溢出問題,我的工作並沒有如此匆忙。 –