jQuery失败不触发

I am quite new to jquery/ajax, but I am trying to use done instead of success and fail instead of error. It does what I want for done, but fail does not seem to be firing? The code below works, but if I change error to fail it does not set value of callback to Error.

done: function() {
    callback("Success");
},
error: function() {
    callback("Error");
}

Anyone know what might be wrong?

Thanks!

Fail is part of the Promise interface so you need to do it like this

$.ajax({})
   .done( function() {} )
   .fail( function() {} )
   .always( function() {} );