SpringMVC 接收Post参数
1.后端实现
@PostMapping("mypost")
@ResponseBody
public String vehicleLicenseMain(@RequestBody Map<String, String> ocrMap) {
String tmpBase64 = ocrMap.get("base64");
String tmpUsername = ocrMap.get("username");
String tmpPassword = ocrMap.get("password");
String res = baiduRec.invokeVehicleLicense(tmpBase64, VehicleLicenseSide.front);
return res;
}
2.postman请求
3.页面实现
$.ajax({
url:"/mypost",
type:"POST",
data:'{
"base64":"GmvHv8AUbsabdB7qHurfKA44xk88c1oLK3FrZQQqABGgX6ip9tdiqGMa6kJJ6HFdWh//9k=",
"username":"ocr",
"password":"gosuncn"
}',
content-type:"application/json charset=utf-8",
success:function(data){
alert("request success ! ");
}
});
还没有评论,来说两句吧...