无法使用backbone.js在服务器上发送post请求

时间:2013-05-30 10:14:02

标签: node.js backbone.js

我在服务器上发出post请求,其id为请求如下:

 app.post('campaign/update/:_id', campaign.update);    

save方法就是调用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) 

0 个答案:

没有答案