function c(){
if(document.getElementById("collection_product")){
$.ajax({
url: "conn/f.php?action=check_collection&type=product&id="+$("#collection_product").attr("pid"),
type:'get',
success:function(res){
if(res=="true"){
$("#collection_product").html("★ has been added to the collection");
}else{
$("#collection_product").html("☆ Add to favorite ");
}
}
});
}
if(document.getElementById("collection_news")){
$.ajax({
url: "conn/f.php?action=check_collection&type=news&id="+$("#collection_news").attr("nid"),
type:'get',
success:function(res){
if(res=="true"){
$("#collection_news").html("★ has been added to the collection");
}else{
$("#collection_news").html("☆ Add to favorite ");
}
}
});
}
if(document.getElementById("collection_course")){
$.ajax({
url: "conn/f.php?action=check_collection&type=course&id="+$("#collection_course").attr("cid"),
type:'get',
success:function(res){
if(res=="true"){
$("#collection_course").html("★ has been added to the collection");
}else{
$("#collection_course").html("☆ Add to favorite ");
}
}
});
}
if(document.getElementById("collection_shop")){
$.ajax({
url: "conn/f.php?action=check_collection&type=shop&id="+$("#collection_shop").attr("mid"),
type:'get',
success:function(res){
if(res=="true"){
$("#collection_shop").html("★ Favorite shops");
}else{
$("#collection_shop").html("☆ Favorite shop ");
}
}
});
}
}
function collect(type,id){
$.ajax({
url: "conn/f.php?action=collect&type="+type+"&id="+id,
type:'get',
success:function(res){
data=JSON.parse(res);
if(data.code=="error"){
alert(data.msg);
if(data.msg=="Please log in to the member and operate"){
$("#clogin").html("[Login]");
}
}else{
c();
}
}
});
}
setTimeout(c,1000);