2.Ext.Ajax.request的用法:
if(flowId != ""){
Ext.Ajax.request({
url : 'findOrderDetailMsg.action',
params : {
'billId' : id
},
method : 'post',
success : function(response, options) {
var o = Ext.JSON.decode(response.responseText);
var args={'userId':adminuser.id,'id':o.id,'inTime':o.inTime,'orgName':o.orgName,'deptName':o.deptName,
'personName':o.personName,'repairPeo':o.repairPeo,'mobile':o.mobile,'phoneNum':o.phoneNum,'mail':o.mail,
'billFrom':o.billFrom,'projectName':o.projectName,'serviceName':o.serviceName,
'serContext':o.serContext,'discription':o.discription,'digest':o.digest,
'happenTime':o.happenTime,'hopeTime':o.hopeTime,'emerge':o.emerge,'proprity':o.proprity,
'timeSite':o.timeSite,'clientType':o.clientType,'closeType':o.closeType,
'comentStatus':o.comentStatus,'contect':o.contect,'score':o.score};
var flag=false;
if(adminuser.id==o.repairPeo){
flag=true;
}
orderWindow=new OrderWindow('finishBill',flag);
var tabPanel=orderWindow.getTabPanel();
orderDetailWindow.removeAll();
orderDetailWindow.add(tabPanel);
orderDetailWindow.show();
tabPanel.tabBar.items.items[3].hide();
tabPanel.tabBar.items.items[2].show();
tabPanel.tabBar.items.items[1].show();
tabPanel.tabBar.items.items[0].show();
orderWindow.setValue(args);
orderWindow.loadFlow(flowId);
},
failure : function() {
Ext.Msg.alert("提示", "模块加载异常!");
}
});
}
他们最大的区别在于Ext.Ajax.request不可以用waitMsg 及waitTitle这些属性,其它的一样。
默认返回为failure类型 的,所以在构造json数据集合时,为true时,要更改一下状态。例如为:context.Response.Write("{success:true,info:'登录成功'}");
如果是Ext.Ajax.request请求时候,先转为json 格式,在取里面信息集合如:
var respText = Ext.util.JSON.decode(fp.responseText);
Ext.Ajax.request只要能将数据发送到action里就提示成功 getForm().submit需要验证返回的json数据必须success才提示成功例如success:true 你这个就是字符串转换json的问题