ajax拼接

$('#').click(function () {
$.ajax({
type:"get",
dataType:"json",
url:"#",
success:function (msg) {
//返回数据处理
console.log(msg);
var length = msg.length;
var html = "";
for(var i = 0;i<length;i++) {
html = html + "<div class='tanchu-list' ondblclick='db(this)'>" +
"<span>" + msg[i].id + "</span>" +
"<div>" + msg[i].n_gift_name + "</div>" +
"<span>" + msg[i].n_gift_type + "</span>" +
"</div>";
}
$(".listInfo").html(html)
}
})
})
posted @ 2017-10-08 17:09  zc_boy  阅读(1241)  评论(0编辑  收藏  举报