1.SpringBoot 如何从前台传递数组
2、前台
$.ajax({
url: 'deleteBsGiftById',
type: 'post',
dataType: 'json',
data: {
ids: idArray
}
)}
3、后台接收
@PostMapping("deleteBsGiftById")
@ResponseBody
public boolean deleteBsGiftById(@RequestParam(value = "ids[]") String[] ids) {
return true;
}
4、@RequestBody 接收数组 前台需要传递Json类型
后台:
@RequestMapping("deleteVillages")
public JSONObject deleteVillages(@RequestBody String[] id){}
前台: