js里的数组push用法及append()


result.result[0].name

var arr = new Array();
$.each(result.result, function(i, item) {
            arr.push("<li onclick=\"tiaoZhuan('"+item.id+"')\">");
            arr.push("<div class=\"shopList-ima\">");
            arr.push("<img src=\"${ctx }/static/wx/images/shopima.png\" alt=\"门店图片\"/>");
            arr.push("</div> <div class=\"shopList-txt\">");
            arr.push("<h3>"+item.customername+"</h3>");
            arr.push("<p>评价<img src=\"${ctx }/static/wx/images/star.png\" alt=\"门店评价\"/></p>");
            arr.push("<p>"+item.address+"</p>");
            arr.push("<p>电话:"+item.tel+"</p>");
            arr.push("</div></li>");
            });
            $("#shopid").append(arr.join(""));    
        },


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM