I have 2 JS functions:
check_fields()
and send_form()
.
send_form()
function should call check_fields()
function:
function check_fields()
{
//do an ajax request causing a little delay
//return true in case of valid fields or false in case of error(s)
}
function send_form()
{
if ( !check_fields() )
return;
//do stuff here
}
The problem is that send_form() function doesn't execute quickly, so I have to know when it had executed completely. How could I know that?
PS: If I remove the ajax request, everything works fine.