后台代码:
@ResponseBody
@RequestMapping(method = RequestMethod.POST,value = "/create")
public Map<String,Object> create(@RequestBody LPEntity lp){
System.out.println(lp);
Map<String,Object> res = new HashMap<>();
res.put("a", lp);
return res;
}
}
前端ajax代码:
var obj = {"id":"ID101010","deviceCode":"100100600","name":"graphId101010"};
$.ajax({
url:url,
type:'post',
dataType:'json',
data:JSON.stringify(obj),
contentType:"application/json",
success:function(res){
debugger;
console.log(res);
}
});
网友评论