I am submitting my array from jQuery Datatables for server side processing, in the following form
Creating the array
var testArr = [];
testArr.push('A')
and under the $('#form').submit function
$.ajax({
url: 'run',
data: testArr,
dataType :"json",
success: function(testArr){
alert( "Data Saved: " + testArr);
}
});`
And on the Spring Controller side , my annotation looks like this
@RequestMapping(value="/run", method=RequestMethod.POST,
headers="Accept=application/json")
public String run(@RequestParam("testArr") JSON testArr) {
When I submit the data for server side processing , it throws me an error stating that
Required JSON parameter 'testArr' is not present
I am unable to understand what am I doing wrong. Please help.
data: { 'testArr': testArr }