springboot ajax post 数组 400解决办法

来源:互联网 发布:用c语言输出直角三角形 编辑:程序博客网 时间:2024/06/05 15:22
<tr th:each="product,stat:${page.content}">
<input type="checkbox" name="ckbox" th:value="${product.productID}"/>
</tr>
html
首选 获取选择的产品id数组
var checkedList = new Array();
$("input[name='ckbox']:checked").each(function () {    checkedList.push($(this).val());});
$.ajax({    url: '/update/mulLockRepost',    data: {'productIds':checkedList+'' },    type: 'post',    dataType: "json",    success: function (result) {        alert(result.message);    },    error: function (result) {        alert(result.message);    }});
controller
@ResponseBody@PostMapping("/mulLockRepost")public Result mulLockRepost(@RequestParam String[] productIds) {    *****    return result;}

原创粉丝点击