Molisa 发表于 2013-1-23 02:06:44

jQuery+json

public ActionForward getDocsOfDirecotry(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response){String wdbh = request.getParameter("wdbh");String jsonStr = "";List<FileInfo> list = privateDocBusiness.getFileByMenuId(wdbh);if(list != null) {JSONArray json = JSONArray.fromObject(list);jsonStr = json.toString();}else {jsonStr = "false";}try {request.setCharacterEncoding("gb2312");response.setContentType("text/json;charset=gb2312");PrintWriter out = response.getWriter(); System.out.print(jsonStr);out.print(jsonStr);   out.flush();   out.close();} catch (UnsupportedEncodingException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}return null;}jquery:$.ajax({      type:"post",                   url:"/Nautilus/document.do?method=getPermissions",                   data: {"wdbh" : id},                success:function(data){             var json = eval(data);             var index = 0;             $("td").each(function(){             var num = parseInt($(this).text())             if(num > index) index = num;             });             //var index = $('#affterPermissions').prev().children('td:first').html();             //if(index == '编号') {             //index = 0;             //}             var permitId;               $.each(json, function(i) {   
页: [1]
查看完整版本: jQuery+json