【js】
function del(){
alert(id);
$.get("login/deleteCheckedMessage?id=" + id,function(data){
if("success" == data.result){
alert("删除成功");
//window.location.reload();
window.location.href="/MessBoard/home.jsp";
}else{
alert("删除失败");
}
});
}
【controller】
@RequestMapping(value="/deleteCheckedMessage" ,method = RequestMethod.GET)
public void deleteCheckedMessage(String id,HttpServletRequest request,HttpServletResponse response){
String result = "{\"result\":\"error\"}";
int i=userManager.delCheckedMessages(id);
System.out.println("=========iii======="+i);
if(i>0){
result = "{\"result\":\"success\"}";
}
response.setContentType("application/json");
try {
PrintWriter out = response.getWriter();
out.write(result);
} catch (IOException e) {
e.printStackTrace();
}
}