Before: .done() method only works with jQuery object
After: .then() method works with both
}
}
return (deferred || new $.Deferred())
- .done(function(data) {
+ .then(function(data) {
// If the server returns an error msg call the error handler
var status = $.isPlainObject(data) && (data.is_error || data.status === 'error') ? 'error' : 'success';
handle(status, data);
- })
- .fail(function(data) {
+ }, function(data) {
handle('error', data);
});
};