开发者

jQuery replaceWith(data) is not correctly doing his job

i did a small ajax div refresh, but instead of replacing the values with the new ones, jquery adds the new data before the old ones.

What possibily causes that please ?

<script type="text/javascript">
$(document).ready(function(){


        $('#AJAX').click(function(e){  
            e.preventDefault();  
            var hebergeur = $('#hebergeurJQUERY').val();

                $.post("/statistiques/maj-bloc-commentaires.php", { hebergeur : hebergeur },
                 function(data){
                    // déclenchée seulement si succès
                    $(开发者_如何学JAVA"#TOREPLACE").replaceWith(data).val( );
                 });  
            });


 }); 
</script>

The HTML :

    print '<div id="TOREPLACE">
<div class="detail_commentaires"> 
        <table class="tableau_detail_commentaires">
         <tr>
          <td class="tab_space">Serveur <strong>'.$row['type'].'</strong></td>
          <td>Qualite</td>
          <td style="color:'.$c_vote.'">'.htmlentities($row['vote']).'</td>
         </tr>
</table>
</div>
</div>';

The PHP ajax echo :

print '

<table class="tableau_detail_commentaires">
 <tr>
  <td class="tab_space">Serveur <strong>'.$row['type'].'</strong></td>
  <td>Qualite</td>
  <td style="color:'.$c_vote.'">'.htmlentities($row['vote']).'</td>
 </tr></table></div></div>';

Thanks


Ok, i finally found that the ID to replace was inside a PHP loop

i fixed that ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜