后台查出来的数组显示在页面

2021-06-07 00:02

阅读:699

标签:alt   pre   group   att   http   mem   mod   fun   red   

HTML页面:

   div class=" row t1" style="text-align:center;">
            div class="form-group col-xs-2  col-md-offset-1">
                div class="panel panel-danger" style="background-color:whitesmoke">
                    div class="panel-heading" style="background-color:orangered;color:white">
                        h3 class="panel-title">需扫描数h3>
                    div>
                    div class="panel-body tt" style="color:orangered;font-size:15px;font-weight:bold;" data-key="Scaned">
                        0
                    div>
                div>
            div>
            div class="form-group col-xs-2  col-md-offset-2">
                div class="panel panel-success" style="background-color:whitesmoke">
                    div class="panel-heading" style="background-color:green;color:white">
                        h3 class="panel-title">已扫描数h3>
                    div>
                    div class="panel-body" style="color:green;font-size:15px;font-weight:bold;" id="tt" data-key="BeScaned">
                        0
                    div>
                div>
            div>
            div class="form-group col-xs-2 col-md-offset-2">
                div class="panel panel-default" style="background-color:whitesmoke">
                    div class="panel-heading" style="background-color:grey;color:white">
                        h3 class="panel-title">待扫描数h3>
                    div>
                    div class="panel-body" style="font-size:15px;font-weight:bold;" data-key="WaitScaned">
                        0
                    div>
                div>
            div>
        div>

JavaScript:

$.get(_reqUrl.getData, { MemberName: $.trim(MemberName) }, function (result) {                 
                    var model = result.Custom;                              
                    var t1 = model.t1[0]; //t1 = {Scaned: 2, BeScaned: 0, WaitScaned: 2};            
                    $.each($(‘.t1‘).find(‘div[data-key]‘), function (i, m) {
                        $(m).html(t1[$(m).attr(‘data-key‘)]);
                    });
                });

效果图:

技术图片

 

后台查出来的数组显示在页面

标签:alt   pre   group   att   http   mem   mod   fun   red   

原文地址:https://www.cnblogs.com/nanxixi/p/14597510.html


评论


亲,登录后才可以留言!