SandaruwanH SandaruwanH - 1 year ago 43
Javascript Question

what are the advantages of done() method in $.ajax instead of success()

For example:

url: '@Url.Action("_sampleMethod","Sample")',
type: 'GET',
cache: false,
}).done(function (result) {
// ...

Answer Source

done() method is helpful when there is a series of multiple Ajax calls and one waits on other to complete the callbacks. So that only after Ajax call A gets completed you execute your post Ajax code in done() . While success() is mainly a part of a single Ajax call that helps you process the response according to your needs .