(len == 0){ $(".tishi").show() } $(".huifu_btn").click(function(){ name = $(this).data("name"); pid = $(this).parents(".pl_li").find(".com_id").val(); $(".pid").val(pid) console.log(pid) $(".pl_text").attr("placeholder","to:" + name); // var com_id = $(".com_id").val() }) $(".linglin_list li").each(function(){ var is_f = $(this).find(".dianzan").find("input").val() var is_kong = $(this).find(".huifu p").length console.log(is_kong) if(is_kong==0){ $(this).find(".huifu").html("

暂无回复

") } if(is_f==0){ $(this).find(".zan_y").hide(); $(this).find(".zan_n").show(); }else{ $(this).find(".zan_y").show(); $(this).find(".zan_n").hide(); } }) //点赞和取消点赞方法 $(".dianzan").click(function() { var type = 1; var ty_yuan = $(this).find("input").val() var shu = parseFloat($(this).next(".shu").text()); //console.log(type) var commons_id = $(this).data('id'); //console.log(commons_id) //点赞type=1; //取消点赞type=0; console.log(shu) if(ty_yuan==0){ type = 1 $(this).find("input").val(1) shu= shu+1 $(this).next(".shu").text(shu); $(this).find(".zan_y").show(); $(this).find(".zan_n").hide(); }else{ type = 2 $(this).find("input").val(0) shu= shu-1 $(this).next(".shu").text(shu) $(this).find(".zan_y").hide(); $(this).find(".zan_n").show(); } //评论id $.ajax({ url: "/show/fabulous.html", type: 'POST', data: { commons_id: commons_id, type: type }, }) .done(function(res) { console.log(res) res = $.parseJSON(res) console.log(res) if(res.code==209){ alert("请登录") window.location.href="/index.php/Public/login"; }else{ } }) }) })