js主要看红色字体即可
(注意这里的html不能换成text方法,不然没有样式的,$("#wczMsg").html(rtn);)
$("#searchWcz").click(function() { var url = __ctx+"/yjfhltjbwczb/yjfhltjbwczb/yjerrordatarecord/getWczMsg.ht"; var rq = $("#hidRq").val(); var params = { rq : rq } $.ajax({ url:url, data:params, type:"post", async:true, success:function(rtn){ $("#wczMsg").html(rtn); $.ligerDialog.open({ target: $("#wczMsg"), title:'查询信息', 900, height: 450 }); }, error:function(rtn){ $.ligerDialog.alert(rtn); } }); });
div 放那都行
<div id="wczMsg" style="display:none"></div>
java后台 异步请求返回的字符串,自己随意添加样式即可
@RequestMapping("getWczMsg") @ResponseBody public String getWczMsg(HttpServletRequest request) throws Exception { String result = "false"; String rq = request.getParameter("rq"); try { Yjerrordatarecord swdlWcz = yjerrordatarecordService.getByRqAndZdlx(yd); result = "<b>电量:</b><br>"+ "上一日电量("+swdlWcz.getZrjldl()+") - 上一日积分("+swdlWcz.getZrjfdl()+") = 差值("+swdlWcz.getDlrwcz()+")<br>"; logger.info(result); } catch (Exception e) { logger.info("查询失败!!!" + e.getMessage()); result = "查询失败!!!"+ e.getMessage(); } return result; }
关闭div
$.ligerDialog.hide();
附上一条layer框架的open
//页面层-自定 layer.open({ type: 1, title: false, closeBtn: 0, shadeClose: true, skin: 'yourclass', content: '自定义HTML内容' });