1.问题
后台获取不到Ajax传过来的值
2.贴上相关代码
前台ajax请求;
$.ajax({
url:user/updateHeadImage,
date:{userId:"1",headImage:"Image"},
dataType:'json',
//type:'POST',
success:function(data){
if(data.success){
alert(data.data);
}else{
common.failure(data.data);
}
}.bind(this),
error:function(xhr, status, err){
console.error(url, status, err.toString());
}.bind(this)
})
3.后台java代码:
@RequestMapping(value = "/updateHeadImage")
@ResponseBody
public Result updateHeadImage(Integer userId,String headImage)throws AppException{
memberService.updateHeadImage(userId, headImage);
Member member=new Member();
member.setId(userId);
member.setHeadImage(headImage);
return new Result<>(true,member);
}
4.贴上相关截图