Use variable outside the success function from an ajax/jquery call

后端 未结 5 794
北海茫月
北海茫月 2020-11-27 22:04

I have the following code

var test;
     $.ajax({
        type: \"GET\",
        url: \"../views/person/controller.php?actor=person&action=checkAge\",
           


        
5条回答
  •  迷失自我
    2020-11-27 22:43

    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.

提交回复
热议问题