JQuery Ajax 500 Error Handling

$.ajax({
    statusCode: {
        500: function() {
          alert("Script exhausted");
        }
     }
});
Prasad Gayan