(updated) How to add AJAX error handling to a (fully) custom registration form?

I think that main problem here is that you try to use “fail” to indicate the state where form has errors. This is wrong, because ajax call will “success” even when form will have errors, because from jquery point of view – it made a ajax call and got response.

Fail will be called only on 404 errors etc.