express如果获取ajax发送的data
$.ajax({ type:“POST”, url:"/purchase/applyForPurchase", dataType:“json”, //timeout:3500, data:idList, //data数据是idList=[ // {_id:12312312}, // {_id:35464564} //] success:function(data){ if (data) {//根据返回值进行跳转 //window.location.href = ‘你的跳转的目标地址’; console.log(data) } } })
exports.applyForPurchase=function(req,res){ console.log(req.body) } 然后打印出{ undefined: [ ‘’, ‘’ ] }