在jsp中 运用jquery的ajax总结



在jsp中 运用jquery的ajax总结

运用jquery的ajax 请求中运用ajax
function modifyPassword(){

if(singleCheck()){
$.post(“checkModifyPassword.htm”,{id : $($(“input[name='id']:checked”).get(0)).val()}, function(data){
if(data == “2″){
ymPrompt.errorInfo({title:’操作错误信息’,message:’商户处于修改待审核状态,禁止操作’});
}
else if(data==”3″) {
ymPrompt.errorInfo({title:’操作错误信息’,message:’此商户已注销’});
}
else{
window.location.href=”modifyPassword.htm?id=”+$($(“input[name='id']:checked”).get(0)).val();
}
});
}
}

 
@RequestMapping
public String modify(HttpServletResponse response, Long id, Model model) {
String result = “1″;
String uri = “”;
response.setContentType(“text/plain”);

Merchant merchant = null;
try {
merchant = merchantService.detailMerchant(id);
// 如果此时商户状态为待审核状态
if (merchant.getStatus() == MerchantStatusEnum.MODIFY_WAIT_APPROVE
.getCode()) {
result = “2″;
uri = “”;
throw new Exception(“商户处于修改待审核状态”);
} else if (merchant.getStatus() == MerchantStatusEnum.DELETE
.getCode()) {
result = “3″;
uri = “”;
throw new Exception(“此商户已注销”);
} else {
queryMerchantTypeAndStatus(model);
model.addAttribute(“merchant”, merchant);

model.addAttribute(“paymentList”, merchant.getPayment());
return “merchantmanage/merchant-modify”;
}
} catch (Exception e) {
logger.error(“修改出错”);
}
try {
response.getWriter().write(result);
response.getWriter().flush();
} catch (IOException e) {
logger.error(“”, e);
}
return uri;
}