首页 > 代码库 > 强大的 数组排重

强大的 数组排重

function going_load(){
net.ajax({
url:"going",
data : {
num:going_num
},
success:function(data){
var _data = http://www.mamicode.com/data.data,
cur_data = http://www.mamicode.com/[]
_data.forEach(function (v,k){
var cur_id = v.id;
if (!goingList[‘id_‘+cur_id]){
goingList.push(v);
goingList[‘id_‘+cur_id] = v;
cur_data.push(v);
}
})

going_num++;
if (cur_data.length > 0){
$main_going.prepend(tpl.render(tpl_going,{data:cur_data}));
}
}
})
}

强大的 数组排重