//後臺方法 Model model = new Model; model.put("msg",true); PrintWriter w; w = response.getWriter(); response.setContentType("text/json; charset=utf-8"); String res = JsonUtil.toJson(model); w.write(res); w.close(); //前臺調用 ajax直接.屬性就能夠了 $.ajax({ type: "POST", url: "${ctx}/mbr/actives/add?type="+type, data: datas, success: function(msg){ if(msg.msg==true){ $.messager.info("保存成功"); window.close(); refreshParent(); }else{ $.messager.error("保存失敗"); } } });