• json返回数据拼接HTML


     <div class="box-lists">  </div>

     $.ajax({                

    url: 'AjaxPage/AjaxHandler.ashx',                

    type: 'POST',                

    data: 'ajaxType=pagelist&pageSize=12&pageIndex=1',                

    dataType: "jsonp",                

    cache: !0,                

    jsonpCallback: "define",                

    async: false,                

    timeout: 5e3,                

    error: function () { },                

    success: function (obj) {                    

    result1 = eval(obj)[0];                    

    result2 = eval(obj).splice(1, obj.length);                    

    //有数据                    

    if (result1.allNum > 0) {                        

    $("#allNum").html(result1.allNum);                    

    }                    

    if (result2 != null && result2 != "") {                        

    var temp = '';                        

    for (var i = 0; i < result2.length; i++) {                            

    temp = temp + "<div class='more-box'><div class='box-img'><img src='" + result2[i].ImgPath + "' alt='' width='233' height='142'></div><div class='box-text'><div class='f-fl'><p class='box-text-t'>" + result2[i].Title + "</p><p>设计价 : <span class='color1'>" + result2[i].Price + "</span>元</p></div><a href='" + result2[i].Url + "' target='_blank' class='f-fr'>提交设计</a></div></div>";

                            }                        

    $(".box-lists").html(temp);                    

    }                

    }            

    });

            });

  • 相关阅读:
    EOJ 1068 石子游戏-B
    二分图匹配(匈牙利算法模板)
    注入(3)--远程线程注入(CreateRemoteThread)
    cmd运行Java命令时编译通过,但是找不到主类或无法加载主类
    Java线程的两种实现方法
    Java String类一些操作的内存问题
    Java构造方法的继承调用
    Android布局(5)--绝对布局(AbsoluteLayout)
    Android布局(4)--相对布局(RelativeLayout)
    Android布局(3)--帧布局(FrameLayout)
  • 原文地址:https://www.cnblogs.com/rukialu/p/4287876.html
Copyright © 2020-2023  润新知