jQuery Datatables中不存在必需的JSON参数 [英] Required JSON parameter is not present in jQuery Datatables
问题描述
我从jQuery Datatables提交我的数组,用于服务器端处理,格式如下:
创建数组
var testArr = [];
testArr.push('A')
和 $('#form')。提交
函数
$。ajax({
url:'run',
data:testArr,
dataType:json,
success:function(testArr){
alert(Data Saved:+ testArr);
}
});`
在Spring Controller端,我的注释看起来像这样
@RequestMapping(value =/ run,method = RequestMethod.POST,
headers = Accept = application / json)
public String run(@RequestParam(testArr)JSON testArr){
当我提交服务器端处理数据时,它会抛出一个错误,指出
必需的JSON参数'testArr '不存在
我无法理解我做错了什么。请帮助。
jSon和jSonP是对。你没有发送一对为了测试目的,请尝试testArr.push({'A':'a'})
ps:我是新手!
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.
jSon and jSonP are pairs. You are not sending a pair. For test purposes, try testArr.push("{'A':'a'}")
ps: I am a novice!
这篇关于jQuery Datatables中不存在必需的JSON参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!