ExtJS的:两个平行的Ajax调用 [英] Extjs: two parallel ajax call

查看:124
本文介绍了ExtJS的:两个平行的Ajax调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的code创建的两个同时ajax调用(我假设的并行效率会比较高)。我想加载一个表,如果两次调用都成功。什么是这样做的正确方法?

解决方案

  VAR成功= {};

功能callBackOne(){
     succeeded.one = TRUE;
     //你的其他的东西
     如果(succeeded.two){bothHaveSucceeded());
}


功能callBackTwo(){
     succeeded.two = TRUE;
     //你的其他的东西
     如果(succeeded.one){bothHaveSucceeded());
}
 

my code creates two ajax call at the same time (i assume the parallelism would be more efficient). I want to load a table if both calls succeed. What's the proper way of doing this?

解决方案

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());
}

这篇关于ExtJS的:两个平行的Ajax调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆