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[name='index']").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) {