I have the following code
var test; $.ajax({ type: \"GET\", url: \"../views/person/controller.php?actor=person&action=checkAge\",
Probably because Validate.fail(test) occurs immediately after the asynchronous call. Remember it is ASYNCHRONOUS, meaning it executes parallel to javascript running on your page.