这是ajax发送数据
url:"${APP_PATH}/addstuInfos",
type:"POST",
data:$("form").serialize(),
success:function(result){
console.log(result)
//alert(result.code)
if (result) {
alert("添加成功!");
window.location.href="${APP_PATH}/student";
return false;
}
},
error:function(xhr, msg, err){
console.log(xhr);
return false;
}
})
这是后台处理数据,后能够处理成功
@ResponseBody
@RequestMapping(value="addstuInfos",method=RequestMethod.POST)
public boolean addstuInfo1(Student student){
student.setStuZsCount(0);
System.out.println("进来了");
//System.out.println(studentService.addStu(student));
if (studentService.addStu(student)) {
System.out.println("成功");
return false;
}
return true;
}
```这是添加数据的ajax请求,数据能够发送成功,添加成功,但是在回调函数里面就是得不到返回值(期间获取到过一次,重新运行就什么都没有了,后面也没有)。我的删除的ajax请求也是这么做的但是能获得后台返回的值。我检查了好多遍,回调函数里面依然没有,求大神指教!!!!