Rule Definition
Ensure that each web service callback is going to be properly checked in order to make sure you will not miss any problem that occurred in your application and you will give the information to the user.
Remediation
Ensure the done, fail and/or always callbacks have been implemented
Violation Code Sample
var jqxhr = $.ajax( "example.php" )
// Perform other work here ...
Fixed Code Sample
var jqxhr = $.ajax( "example.php" )
.done(function() {
alert( "success" );
})
.fail(function() {
alert( "error" );
})
.always(function() {
alert( "complete" );
});
// OR
// Set another completion function for the request above
jqxhr.always(function() {
alert( "second complete" );
});
Reference
http://api.jquery.com/jQuery.ajax/#options
Related Technologies
Technical Criterion
Programming Practices - Error and Exception Handling
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.