这是脚本:
function accept(id,value){
$.ajax({
url:'/accept',
method:'POST',
dataType:'JSON',
data:{id:id,value:value},
success:function(doc){
var id=doc._id;
$.ajax({
url: "/remove",
type: "post",
data: {id:id},
success: function (data) {
}
});
this is index.js:
post('/ remove',function(req,res,next){
var id = req.body.id;
var removeata = reqmodel.findByIdAndDelete(id);
removedata.exec(function(err){
if (err) throw err;
});
and error is:
reqmodel.findByIdAndDelete不是函数**
答案 0 :(得分:0)
var removeata = reqmodel.findByIdAndDelete(id)
替换为
var removeata = reqmodel.findByIdAndRemove(id)