ajax pass array

Passing data in ajax can use

var checkedIds = new Array();
			checkedIds.push(1);
			checkedIds.push(2);
			checkedIds.push(3);
			$.ajax({
				url:"bookBatchdelete.do",
				data:{
					checkedIds : checkedIds
				},
				type:"post",
				dataType:"json",
				traditional: true,
				success:function(data){
					
				}
			})
	

 

Background receive can use:

@RequestMapping(value="xxx.do")
	@ResponseBody
	public String bookBatchDelete(HttpServletRequest request, String[] checkedIds){
		
		
	}

 

 Note: The key is to set $.ajax({traditional: true,}), otherwise the background String[] checkedIds will not receive the value

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326269735&siteId=291194637