Extjs:两个并行的ajax调用

Pro*_*mer 4 javascript ajax extjs

我的代码同时创建了两个ajax调用(我假设并行性会更高效).如果两个调用都成功,我想加载一个表.这样做的正确方法是什么?

Thi*_*ilo 5

var succeeded = {};

function callBackOne(){
     succeeded.one = true;
     // your other stuff
     if (succeeded.two) { bothHaveSucceeded());
}


function callBackTwo(){
     succeeded.two = true;
     // your other stuff
     if (succeeded.one) { bothHaveSucceeded());
}
Run Code Online (Sandbox Code Playgroud)