js接收后台model传来的list
1、将model传递的list变为json格式
model.addAttribute("list", JSON.toJSONString(list));
2、通过html接受该json
<span th:text="${list}" style="display: none" id="list"></span>
3、通过js获取html的json,并对其操作
var json = eval('(' + $("#list").text() + ')');//获取json
$.each(json, function (index, content) {//遍历json
alert(index+","+content);
});