net.sf.json.JSONArray 转换的Json 在非Ajax中如何转换成js对象

来源:互联网 发布:康熙停播原因 知乎 编辑:程序博客网 时间:2024/05/27 09:48
1、java后台
JSONArray arr2 = JSONArray.fromObject(compCells);String result2 = arr2.toString();model.addAttribute("compCells",result2.replaceAll("\"", "'"));
2、html
<input type="hidden" value="${compCells}" id="compCells">

3、js

var compCells =  $("#compCells").val();var jsonData2 = eval( '(' + compCells + ')' );


0 0
原创粉丝点击