Jquery Ajax 异步请求

Ajax异步请求Code示例:
$.ajax( {
type : "post",
// 查询所有区县
url : 'transType.action',
async : false,
dataType : "json",
data : {
"sCity" : startCityCode,
"aCity" : arrivedCityCode,
"sArea" : startAreaCode,
"aArea" : arrivedAreaCode
},
success : function(data) {
if (data == null || data.length == 0) {
cleanTransportTable();
$("#errTxt").text("未查找到运输路线");
return;
} else {
if (data.pricelist.length == 0) {
cleanTransportTable();
$("#errTxt").text("未查找到运输路线");
return;
}
pricePlanBean = data.pricelist;
count = data.count;
isPilotCityOfA = data.isPilotCityOfA;
hasAgentCityOfA = data.hasAgentCityOfA;
orgCount = data.orgCount;
//获取出发城市,到达城市,城市code,区域code
departureCity = data.departureCity;
destinationCity = data.destinationCity;
destinationArea=data.destinationArea;
departureArea=data.departureArea;
strVolume = _strVolume;
weight = _weight;
wrap = iswrap;

if (data.orgCountOfCounty == 0) {
alert("该线路尚未开通,运输方式只能选择汽运偏线");
}
$("#createOrder").attr("disabled","");
getTransport();//生成运输类型

}
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
$("#errTxt").text("");
$("#errTxt").text("网络繁忙,请稍后再试!");
}
});

transType.action部分代码:

Map<String, Object> map = new HashMap<String, Object>();
map.put("pricelist", ppi);
map.put("count", count);
map.put("departureCity", sCity);
map.put("destinationCity", aCity);
map.put("departureArea", sArea); //出发城市区域code通过JSON传到订单
map.put("destinationArea", aArea);//到达城市区域code通过JSON传到订单
map.put("isPilotCityOfA", isPilot2); //到达城市是否为试点城市
map.put("hasAgentCityOfA", hasAgent); //到达城市是否为落地配城市
map.put("orgCount", orgCount); //到达城市德邦网点数
map.put("orgCountOfCounty", orgCountOfCounty); //到达区县德邦网点数
json = map;
return "JSON";
}
return "JSON";
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值