根据服务器返回的结果,判断显示哪一个panel居然不成功,没找到可行的解决方案,代码如下:
var sign=0;
Ext.Ajax.request({
         url:'xxx.action',        //这里返回"true"
method:'GET',
success:function(form,action){
sign=1; },
failure:function(form,action){
sign=2;
}
});
这个ajax返回trueif(sign =1){alert("1");}
else{alert("2");}
问题:
Ext.Ajax.request好像不能访问变里,如果想做这个判断有好的方法吗,以上可能是错误方法,google了一些也没解决

解决方案 »

  1.   


    function getOrder(){
    this.id = "";
    this.gradeId = "";
    this.funName = "";
    var self = this;
    //ajax请求方法,根据工单编号
    this.ajax = function(){
    //询问管理员是否接单
    if(window.confirm("是否接单?")){
    if(this.gradeId == 1){
    alert("对不起,支持工程师没有接单的权限");
    return false;
    }else{
    new Bom.Ajax().Request({
    url:"getorder.html",
    method:'post',
    success:function(res){
    //如果接单成功就刷新数据
    if(self.gradeId != 4){
    new ajaxSelectOrder().run(self.gradeId,self.funName,currnentCount);
    }else{
    window.open("selectorderinfo.html?orderId="+self.id+"");
    new ajaxSelectOrder().run(self.gradeId,self.funName,currnentCount);
    }
    },
    params:{orderId:this.id}
    });
    }

    }
    }
    //成员属性初始化方法
    this.run = function(id,gradeId,funName){
    this.id = id;
    this.gradeId = gradeId;
    this.funName = funName;
    this.ajax();
    }
    }
    /*
    该方法用于二线工程师修改工单的状态
    */
    function updateOrderState(){
    this.id = "";
    this.gradeId = "";
    this.funName = "";
    this.isGo = "";
    this.content = "";
    var self = this;
    this.ajax = function(){
    var cn = this.content;
    cn = encodeURI(cn);
    cn = encodeURI(cn);
    new Bom.Ajax().Request({
    url:'updateorderstate.html',
    method:'post',
    success:function(res){
    //如果接单成功就刷新数据
    new ajaxSelectOrder().run(self.gradeId,self.funName,currnentCount);
    },
    params:{orderId:this.id,gradeId:this.gradeId,isGo:this.isGo,content:cn}
    });
    }
    this.run = function(id,gradeId,funName,isGo,content){
    this.id = id;
    this.gradeId = gradeId;
    this.funName = funName;
    this.isGo = isGo;
    this.content = content;
    this.ajax();
    }
    }这个是我以前自己写的方法。。希望对你有用。。应该能实现你要的那种功能