registration with ajax and error handling