jQuery Deprecation Notice jqxhr.success()
jquery
Solution
For instance, if you have any of these:
$.ajax({url: '...'}).success(function(){
alert('AJAX successful');
});
$.ajax({url: '...'}).error(function(){
alert('AJAX ERROR');
});
$.ajax({url: '...'}).complete(function(){
alert('AJAX complete');
});
You would have to change it to:
$.ajax({url: '...'}).done(function(){
alert('AJAX successful');
});
$.ajax({url: '...'}).fail(function(){
alert('AJAX ERROR');
});
$.ajax({url: '...'}).always(function(){
alert('AJAX complete');
});
Problem
I recently saw a deprecation notice on the jQuery website. Deprecation Notice: The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callbacks will be deprecated in jQuery 1.8. To prepare your code for their eventual removal, use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead. I am currently coding as below: ``` $.ajax({ url: '...', success: function(){ alert('AJAX successful'); } }); ``` I am planning to use jQuery 1.8+ Should I just change the `success` key into `done` as: ``` $.ajax({ url: '...', done: function(){ alert('AJAX successful'); } }); ``` ?