后台: //得到报修人数据 public String getBaoxiuInfo(){ HttpServletRequest request = getHttpServletRequest(); WarrantyService workorder = new WarrantyService(); String ws_num = request.getParameter("re_num"); workorder.setWs_num(ws_num); //设置编号 JSONArray jsonArray = new JSONArray(); JSONObject jsonData = new JSONObject(); jsonArray.add(JsonUtil.beanToJson(getiWarrantyServiceService().selectBaoxiuInfo(workorder))); //将得到的model类转为Json,放入json数组中 jsonData.put("BaoxiuInfo",jsonArray); //jsonData中数据格式:{"BaoxiuInfo": [{"ws_num":"abcd"}]} printHttpServletResponse(jsonData.toString()); return null; } 前台: Ext.Ajax.request({ url: 'warrantyServiceAction!getBaoxiuInfo.shtml',method: 'POST',params: {re_num:recordtoedit.get("re_num")},success: function(response) { var jsonObj = Ext.util.JSON.decode(response.responseText); alert(jsonObj.BaoxiuInfo[0].ws_num); //结果为abcd } });@H_502_1@ 原文链接:https://www.f2er.com/ajax/165876.html