Merhaba arkadaşlar. Jquery ile bir tabloda bir satırı tamamen silerek, bu esnada sayfa yenilenmeden sadece o satır ortadan kalksın istiyorum. Bunu yapabiliyorum fakat sadece tek bir td alanını siliyor. Fakat benim tablom da 6 adet td alanı mevcut ve while ile döngü içerisinde. tr içerisine birden fazla td eklediğim zaman sadece sil linkini verdiğim td alanını siliyor. Bir türlü çıkamadım işin içinden :)
Sorgu sayfası:
<?php
include("db.php");
//SORGU STANDART BAŞLA//
$hesapCekSTANDART = $db->prepare("SELECT * FROM group WHERE profilgroup='STANDART'");
if($hesapCekSTANDART === false) {
die('Sorgu hatası:' . $db->error);
}
$hesapCekSTANDART->execute();
$hesapCekSTANDARTSonuc = $hesapCekSTANDART->get_result();
//SORGU STANDART BİTİR//
echo "<table class='update'>";
while($sonucSTANDART = $hesapCekSTANDARTSonuc->fetch_object()){
echo "
<tr>
<td>sdas</td>
<td>sdsds<a href='#' id='{$sonucSTANDART->username}' class='delete_button'>Sil</a></td>
</tr>
";
}
echo "</table>";
?>JS Kodları
$(function() {
$(".delete_button").click(function() {
var id = $(this).attr("id");
var dataString = 'id='+ id ;
var parent = $(this).parent();
$.ajax({
type: "POST",
url: "islem.php",
data: dataString,
cache: false,
beforeSend: function()
{
parent.animate({'backgroundColor':'#fb6c6c'},300).animate({ opacity: 0.35 }, "slow");;
},
success: function()
{
parent.slideUp('slow', function() {$(this).remove();});
}
});
return false;
});
});Css kodları
table.update
{font-size:1.2em;
}
table.update tr td{
height:50px; border-bottom:#dedede dashed 1px; background-color:#ffffff
}