知识点
传JSON字符串+@RequestBody接收
- 前端
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20function icheckDelete(url){
var parms = {
list : array //这是个数组
};
$.ajax({
dataType: "JSON",
contentType:'application/json;charset=UTF-8',//关键是要加上这行
traditional:true,//这使json格式的字符不会被转码
data: JSON.stringify(parms),
type: "DELETE",
timeout: 20000,
url: url,
success : function () {
alert("删除成功!");
},
error : function (data){
alert(data.responseText);
}
});
}
1 | - 后端 |
RESTFUL
-
@RestController
class level annotation and then add the following@RequestMapping
to the class