Backbone model.save does not trigger error or success callback
This is a typical error that happens often so I'm writing it down.
Anyone can spot the error in this code ? :
var deferred = $.Deferred();
recording.save(
{
success : function () {
deferred.done();
},
error : function () {
deferred.done();
}
});
The problem is that the first parameter to save is an object of new member's values and not the options. So you need to add either null or {}.
var deferred = $.Deferred();
recording.save({},
{
success : function () {
deferred.done();
},
error : function () {
deferred.done();
}
});
Recent Comments