我有以下代码
var test;
$.ajax({
type: "GET",
url: "../views/person/controller.php?actor=person&action=checkAge",
data: "age=" + value,
success: function(msg){
console.log(msg);
test = msg;
},
});
Validate.fail(test);
现在测试变量应该像控制台所说的那样给出真假。但是 test var 给了我未定义的为什么?