What is the difference between the 2?
Why this confuses me is due to the documentation. Referring to the one the documentation call 'jqXHR' https://api.jquery.com/jQuery.getJSON/#jqxhr-object
We see this:
The jqXHR.success(), jqXHR.error(), and jqXHR.complete() callback methods are removed as of jQuery 3.0. You can use jqXHR.done(), jqXHR.fail(), and jqXHR.always() instead.
So basically, success(), error() et all is deprecrated, so use done(), fail() et al.
So, in something like this example from the very page,
dataType: "json",
url: url,
data: data,
success: success
});
Is it better to handle success
as such or as .success() / .done()
?
How would the above differ from this?
$.ajax({
dataType: "json",
url: url,
data: data,
})
.done(function(data){
success
});