0
尝试使用collection.create添加模型。我在模型上添加了验证,并且在我尝试创建模型时没有任何反应。但是,无论是成功还是错误回调都不会触发,页面就会在那里。我如何得到实际的错误? (验证只是返回一个像“这是错误的”字符串)Backbone.js:如何从collection.create获取模型验证错误
我相信问题是错误回调仅在服务器返回的错误上触发。但是,如何从这里捕获验证错误?
self.collection.create({
//attributes
}, {
success: function (model, response) {
//this doesn't run
},
error: function (model, response) {
//this doesn't run either
}
});