标签:data response charge for htm 返回 efi flush odi
前台:
$.ajax({
type: ‘POST‘,
url:
‘/admin/mall/category-add-edit.htm?ajax=‘+"ajax",
data: "categoryId=" +
categoryFormid+"&city="+city,
success: function(msg){
//alert(msg);
if(msg==undefined || msg==null ||msg==""){
return ;
}
var jo=eval(‘(‘+msg+‘)‘);
//1百分比 2固定值
$("#charge_type").val(jo.charge_type);
if(jo.charge_type==1){
document.getElementById(‘type1‘).style.display="";
document.getElementById(‘type2‘).style.display="none";
}
if(jo.charge_type==2){
document.getElementById(‘type1‘).style.display="none";
document.getElementById(‘type2‘).style.display="";
}
}
})
后台:
Long categoryId =
ControllerUtils.getLongParameter(map, "categoryId",
request);
response.setContentType("text/html;charset=GBK");
PrintWriter out = response.getWriter();
JSONObject jsonO=new
JSONObject();
GoodsCategoryExt
charge_type=extService.getExt(categoryId, "charge_type");
GoodsCategoryExt fixTip=extService.getExt(categoryId, "fixTip");
GoodsCategoryExt fee=extService.getExt(categoryId, "fee");
jsonO.put("charge_type", charge_type.getExt_str());
jsonO.put("fixTip", fixTip.getExt_str());
jsonO.put("fee",
fee.getExt_str());
out.print(jsonO.toString());
out.flush();
out.close();
return null; //这里必须return null; 否则会return mv等信息,对返回的信息进行干扰
或者
response.setCharacterEncoding("UTF-8");
response.getWriter().write("exist");
response.flushBuffer();
return null;
标签:data response charge for htm 返回 efi flush odi
原文地址:http://www.cnblogs.com/haorun/p/6021056.html