springmvc ajax 传递list参数

xiaoxiao2021-02-28  101

ajax:

$.ajax({ type: 'POST', url:rootPath+"/deviceInfo/saveElements.do", dataType: 'json', contentType: "application/json", data:JSON.stringify(elements), success:function(){ } });

java:

public Result<Boolean> saveElements(@RequestBody List<ElementInfo> elements){ 注意点:

data名字不能给名称,给了会报错

错误范例:

$.ajax({ type: 'POST', url:rootPath+"/deviceInfo/saveElements.do", dataType: 'json', contentType: "application/json", data:{“elements”:JSON.stringify(elements)}, success:function(){ } });

转载请注明原文地址: https://www.6miu.com/read-85385.html

最新回复(0)