Я использую jQuery, чтобы определить, когда пользователь отправил форму. Затем я вызываю, используя xajax, метод php для запроса базы данных и удостоверяюсь, что имя пользователя и адрес электронной почты еще не используются.
$('#newUserForm').submit(function() {
var FormName = $(this).attr('name');
xajax_validateEmailAddressAndUsername(xajax.getFormValues(FormName));
});
Then in validateEmailAddressAndUsername I query the database and validate this way.
The problem that I have encounter is that jquery is asynchronous, and there is no way for me to add a script with the right xajax response before the form gets submitted. how can I address this problem?
should I do it in a different way?
Thank you