我有一个RESTful服务,当我尝试保存新记录时,会进行唯一的电子邮件检查.当它失败时,我返回一个400错误代码以及一个带有"errors"值的JSON消息.
不幸的是,我的保存错误回调似乎没有被解雇.有什么建议?
var nRecord = new RecordModel(values);
nRecord.save({
wait: true,
error: function(model,response){
console.log('error2');
obj.errorHandler(model,response);
},
success: function() {
console.log('success2');
obj.alert('Information saved!','Record Created!','success');
// if there were no errors, clear the list
$('#record-form :input').val('');
}
});
Run Code Online (Sandbox Code Playgroud)
"Error2"永远不会显示在控制台中.思考?
backbone.js ×1