读书人

jquery ajax后台老板向前台传list 前

发布时间: 2012-12-29 10:28:09 作者: rapoo

jquery ajax后台向前台传list 前台用jquery $.each遍历list
下边是两种前台接收并遍历list



下边是后台接收并遍历list

HttpServletResponse res = ServletActionContext.getResponse();res.reset();res.setContentType("text/html;charset=utf-8");PrintWriter pw = res.getWriter();xxx.setId(1);xxx.setName("黑色头发");list.add(xxx);xxx.setId(2);xxx.setName("紫色头发");list.add(xxx);String json = JSONArray.fromObject(list).toString(); pw.print(json);pw.flush();pw.close();


黑色头发:http://heisetoufa.iteye.com/

读书人网 >Ajax

热点推荐