1.Ext异步请求发送
Ext.Ajax.request({
//需要发送的url请求
url : __ctxPath + '/outb/isProjComsEnableObProject.do?projId='+id,
//发送方法:post
method : 'post',
//请求成功时的回调函数
success : function(response) {
////
解析数据,response.responseText为从后台返回的json串
var result = Ext.util.JSON.decode(response.responseText);
//
例如后台返回的json串为:jsonString="{success:false,tesName:'someData'}";
//
那么可以取值:result.success取出的值为false;result.tesName取值为someData
},
//请求发送失败的回调函数
failure : function() {
}
});
2.Ext同步请求发送
//同步请求
var
responsea=
Ext.lib.Ajax.getConnectionObject().conn;
responsea.
open("POST",__ctxPath + '/outb/listCountsObSaletask.do?comId=' + comId
,false);
responsea.send(null);
//
返回的json串为:{"LAY_UP":"1","PLAN":"2","FLOWING":"1","FAIL_CASE":"1","SUCC_CASE":"1","NO_EXEC":"2","CANCELED":"1"}
var result = Ext.util.JSON.decode(responsea.responseText);//解析数据
//
拼装数据
var data = [result.LAY_UP,result.PLAN,result.FLOWING,result.FAIL_CASE,result.SUCC_CASE,result.NO_EXEC,result.CANCELED];