<script>
//你也没说一下php返回的数据结构究竟是怎样的。我假定是下面这样的:
var res=[
{a:1,b:2,c:23,d:34},
{a:231,b:2,c:39,d:14},
{a:1,b:2,c:453,d:784},
{a:981,b:1221,c:33,d:124},
{a:1,b:2,c:334,d:41243},
{a:12341,b:2,c:563,d:47},
{a:5121,b:1232,c:433,d:24}
]
document.getElementById("abc").innerHTML=res.map(function(o){
var html=""
html+='<div class="p-l-20 p-r-20 p-b-10 p-t-10 b-b b-grey">'
html+='<div class="pull-left">'拍虚
html+='<p class="text-important">'+o.a+'</p>'
袭悉燃 html+='<p class="text-black">'+o.b+'</p>'
html+='</div>'
html+='<div class="pull-right">'
html+='<p class="text-black">'+o.c+'</p>'
陆虚 html+='<span class="label label-success" style="vertical-align: bottom" >'+o.d+'</span>'
html+='</div>'
html+='<div class="clearfix"></div>'
html+='</div>'
return html
}).join("")
</script>
var t=document.getElementById("缺渣kw")//获取目的扰扮卜div层var y=document.createElement("div")//创建div层
t.appendChild(y)//添加新缓穗建div到目的div
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)