ajax局部更新

前台:function queryTsr(){
var agentNo;
var userName;
var userCode;
var tsrType = document.getElementById("tsrType").value;
var pointTsr = document.getElementById("pointTsr").value;
alert(tsrType);
alert(pointTsr);
if(tsrType=="" || tsrType==null){
alert("请选择坐席输入类型!");
return false;
}
if(pointTsr=="" || pointTsr==null){
alert("请输入坐席!");
return false;
}
if(tsrType=="1"){
agentNo=pointTsr;
form1.action = "<%=request.getContextPath()%>/getUserAll.do?agentNo="+agentNo;
}
if(tsrType=="2"){
userCode=pointTsr;
form1.action = "<%=request.getContextPath()%>/getUserAll.do?userCode="+userCode;
}
if(tsrType=="3"){
userName=pointTsr;
form1.action = "<%=request.getContextPath()%>/getUserAll.do?userName="+userName;
}
$("form[name='form1']").ajaxSubmit({async: false,
type: "post",
data:{},
contentType:"application/x-www-form-urlencoded; charset=UTF-8",
success:function(json){
var data = eval('(' + json + ')');
var userAllList=data.data;
var allUser=$("#userAll");
allUser.html("");
for(var i=0;i<userAllList.length;i++){
var userAll=userAllList[i];
var td="<td class='inputbg' border='0' colspan='6'>"+
"<input name='userName' disabled='disabled' class='inputbg' style='color:#ff0000;font-family:黑体' value='"+userAll.userName+"'/>"+
"<input name='umCode' disabled='disabled' class='inputbg' value='"+userAll.umCode+"'/>"+
"<input name='agentId' disabled='disabled' class='inputbg' value='"+userAll.agentId+"'/>"+
"</td>";
allUser.append(td);
allUser.show();
}
}
});
}
后台controller
List userAllList = (List) this.getDispatch().dispatchRequest(
CommonUtils.getAggregatedSearchDTO("role.searchUserAll", userDto),
ServiceRequestId.AGGREGATED_SEARCH_ACTION);
ajaxDTO.setData(userAllList);
ajaxDTO.setMsg("success");
resultMap.put(AjaxUtil.JSON_RETURN_OBJECT, AjaxUtil.toJson(ajaxDTO));
// resultMap.put("userAllList", userAllList);
return new ModelAndView(this.getSuccessView(),resultMap);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值