我正在使用 id 在服务器上发出 post 请求,请求如下所示:
app.post('campaign/update/:_id', campaign.update);
保存方法是调用 post 请求的方法:
this.model.save(null, {success: function(data){
});
}});
模型是:
var CampaignEditModel = Backbone.Model.extend({
urlRoot:"http://localhost:3033/campaign/update/",
url : function(){
var url = this.urlRoot + this.id;
console.log("in model:"+ this.id ) ;
return url;
},
idAttribute: "_id",
defaults:{
"id":"",
"Name" :""
}
});
请求是这样的:
http://localhost:3033/campaign/update/5c72e198-c8fd-11e2-9cfa-74867a028324
问题是控制台显示错误:
Failed to load resource: the server responded with a status of 404 (Not Found)