The necessity of validation a field in a form using AJAX it’s really common. Sometimes it can give a little work but the ASP.NET NET 3/4 has one attribute to help us for this kind of work.
Here is a simple demonstration of how to check if a username already exists in the system. Because the username should be unique.
Create an Action to validate if the username already exists.
Put the attribute [Remote] in the field which we want to validate the model (in this case username field) and indicate which action and controller has the validation.
It’s already done, as you can see it’s very easy and effective.
Example: The username “User” is already in the system. (It’s not necessary to submit the form to validate if the user already exists)