Yes it is possible to check a value with ajax.
You could disable the default functionality of the form submit, for example (using jQuery):
$('FORM_ELEMENT').submit(function(e){
//dont submit the form
e.preventDefault();
//if valid url_to_ajax_function should return true or false for example {"found": true}
$.get("url_to_ajax_function?variable=value", function(data){
//check if return ajax request is true
if(data.found){
//found, so submit the form
$(this).submit()
}else {
alert('value not found');
}
});
});
note that this is dummy code, and is only used here to show that it is technically possible, but this is the call as you could make it. It is definitely possible, but some jQuery knowledge is a must.
Another good way to check if the user has a valid field submitted (for example when a user has javascript disabled, so an extra failsave), a plugin could be created. You should use the observer onUserAfterSave()
. Joomla documentary for creating plugin with onUserAfterSave().
Hope this will help you in the right direction!