I have a form, where a captcha is valid via json:
$.getJSON('?verify&string=' + captcha, function( content ){
if(content.comparation){
$("#tokenCaptcha").val(content.token);
}else{
complete = false;
}
});
After a few lines, the function returns true or false to send the form or not. The fact is that it takes a long time to change the value. So much so that the form is sent before the value is modified. I did a test with a value alert, it took about 1 second to give the token alert.