.success()
only gets called if your webserver responds with a 200 OK HTTP header - basically when everything is fine.
The callbacks attached to done() will be fired when the deferred is resolved. The callbacks attached to fail() will be fired when the deferred is rejected.
promise.done(doneCallback).fail(failCallback)
.done() has only one callback and it is the success callback