What I want to show you is how to make remote validators, but what is a remote validator?
A remote validator is a function or method written in the back end which will be called on demand from the front end to ask for a specific business rule. The most common case is validation for availabilty of usernames when you sign up a website. Everytime you type a username the client side(web page on your computer or mibile device) is calling the remote validator to check if the username you typed has not already been taken by someone previously.
feel free to use the same code in your solution.
do not forget to reach me out by twitter @mario_agh