jQuery replaceWith(data) is not correctly doing his job
Posted
by Tristan
on Stack Overflow
See other posts from Stack Overflow
or by Tristan
Published on 2010-04-24T03:52:18Z
Indexed on
2010/04/24
3:53 UTC
Read the original article
Hit count: 253
Hello,
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
$("#TOREPLACE").replaceWith(data).val( );
});
});
});
</script>
The HTML :
print '<div id="a_remplacer">
<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>
</div>
</div>
The PHP ajax echo :
print '<div id="a_remplacer"><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></div></div>
Thanks
© Stack Overflow or respective owner