duandong1963 2014-08-16 17:12
浏览 68
已采纳

删除后隐藏评论

I have tride to add function hide after deleting the comment. but it hide all comments. but i need to hide just deleted comment. there is my js.

$('.delete_p').click(function(){
var del_id = $(this).attr('id_p');
$.ajax({
 type: 'POST',
 url: 'delete_post.php',
 data:'delete_id='+del_id,
 success: function(data){
    $('#status .holder'+del_id).fadeOut();
 }
});
});
 $( ".delete_p" ).click(function() {
 $( "#status .holder").hide("slow");
});

i have tride to add thisbut it doesn't helped.

$( "#status .holder", $(this)).hide( "slow" );

here is html. it is too long. there is just used for comment:

<div id="status">
<div class='holder' id_p='<?php echo $post_id; ?>'>
<div class='holder_half'>
<?php
$default_s_pic = "href=/default_picture.png";
echo "<div id='picture'><a href='/$poster_name'>";
if($adder_pic === ""){
echo '<img src="', $default_s_pic, '" alt="', $poster_f_name,'\'s Profile image">';
}else{
    echo '<img src="', $adder_pic, '" alt="', $poster_f_name,'\'s Profile image">';
}
echo "
</a>
</div>
<div class='ten'>
<div id='statusname'><a href='/$poster_name'>$poster_f_name</a></div>
<div class='date_time'>$data</div>
<span class='span' data-ft='{&quot;tn&quot;:&quot;K&quot;}'>
";
if($posted_place === $deleter || $poster_name === $deleter){
echo "
<button class='delete_p' id_p='". $post_id ."'>x</button>
";
?><script src="delete_post.js"></script>
</div>
</div>
</div>
</div>
  • 写回答

1条回答 默认 最新

  • douque9982 2014-08-16 17:33
    关注

    Change This code:

    <div class='holder' id_p='<?php echo $post_id; ?>'>
    

    to this:

    <div class='holder<?php echo $post_id; ?>' id_p='<?php echo $post_id; ?>'>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)