ligerUi弹出一个div窗口,并且带样式

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:'查询信息',
                          width: 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内容'
});

 

posted @ 2021-04-28 18:38  爱跳舞的程序员  阅读(188)  评论(0编辑  收藏  举报