如何从ajax中的动态生成字段发送多个数据?从动态生成的字段发送多个ajax数据
由于我无法预先知道字段的数量,所以我使用了一个for循环,这对我不起作用。
$.ajax({
type: 'GET',
data:{
expectationPercentagePairId: JSON.stringify(expectationPercentagePairIds),
expectationScores: expectationScores,
for(var id in expectationPercentagePairIds){
score-${id}: $("input[name='score-'+id]")
}
},
url:'${g.createLink(controller:'review', action:'saveReview', params:[id: params.id])}'
});
你可以将数据作为数组/ json – Sherlock
这些字段的名称是不同的。我可以传递数据来自数据来自的字段的名称? – Yet
这个expectationPercentagePairIds的内容是什么? – Sherlock