在添加和编辑的时候,从后台的响应判断是否成功的JS写法
前台的逻辑判断
/** * @since SPC800 * @throws Exception * Exception * @param mapping * mapping * @param form * form * @param request * request * @param response * 此方法为用户在点击查询按钮的时候调用的Ajax验证方法,如果没有数据则不允许open window */ @SuppressWarnings("unchecked") public ActionForward verifySoftwareList(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(false); PrintWriter out = response.getWriter(); //语种 String nls = (String) session.getAttribute(SupportConstants.CFG_NLS); //界面上获取订单号 String pno = request.getParameter("pno").trim(); //界面上获取合同号 String cno = request.getParameter("cno").trim(); JSONObject jsonObj = new JSONObject(); jsonObj.put(PoApplyConstants.NLS_LANG, nls); jsonObj.put(PoApplyConstants.CONTRACT_NO, cno); jsonObj.put(PoApplyConstants.PO_NO, pno); jsonObj.put(PoApplyConstants.IFSELECTED, "VERIFY"); //调用WebService的后台接口 IPoApplyWs poApplyWs = new IPoApplyWsProxy(); String resultStr = poApplyWs.getRelatedSwDetailListById(jsonObj.toString()); String str = ""; if (null != resultStr && !"0".equals(resultStr)) { //"OK " str = "{\"reslut\":\"OK\"}"; out.write(str); //out.write("OK"); } else { str = "{\"reslut\":\"FAILED\"}"; out.write(str); // out.write("FAILED"); } return null; }