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 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试