ajax传递json对象数组到后台

前端:

var dataArray = []//一个数组

$.ajax({

type: "POST",
traditional: true,
contentType:'application/json;charset=UTF-8',
dataType: 'json',
url: url,
data: JSON.stringify({listKey:dataArray}),
success: function(response) {

}

})


后台

@responseBody

@requestMapping("/test")

private String Test(@requestBody Form, HttpServletRequest request){

//..............

}

class Form{

private List listKey;


//get


//set

}

你可能感兴趣的:(ajax传递json对象数组到后台)