javascript - Wait for asyn call to finish - too late -


i have dialog button. once clicked button calls async method returns true or false depending on whether posted data valid or not. click event calls method below. now, problem closedialog called before callback function executed!! how can make work?

thanks

close: function (srccmd) {    var closeresult = true;    asyncthing(function(result) {       if (result)          closeresult = true;       else          closeresult = false;    });      if (closeresult !== false) {        this.closedialog();    } }, 

the function withing asyncthing called when(whenever might be) asynchronous call finished. not interpreted line-by-line.

move latter if question callback function , fine.

close: function (srccmd) {    var closeresult = true;    asyncthing(function(result) {        if (result)            closeresult = true;        else            closeresult = false;     if (closeresult !== false) {        this.closedialog();     }   }); }, 

Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -