InitEventsObj("#tj_sjs","recommshops"); InitEventsObj("#tj_recommlinks","recommlinks"); function InitEventsObj(id, type ) { $.get("lib/get_index_show.php?type="+type,function(data){ var datas = JSON.parse(data); if(Array.isArray(datas) && datas.length > 0) { var html = ""; for(var i = 0, l = datas.length; i < l; i++) { var data = datas[i]; html +='
'; var url=type=="recommshops"?"index.php?do=seller&id="+data.uid:data.link_url; var title=type=="recommshops"?data.shop_name + ',' + data.shop_slogans:data.link_name; html +=''; html +='...'; html +='

'+title+'

'; html +='
'; html +='
'; } $(id).html(html); } }); }