can anyone help me with this code.
Everything is working fine except this piece of code is not working
$(document).ready(
function()
{
$("a.delete").click(
function ()
{
var cnf = confirm("Are you sure you want to delete this ticket?");
if(cnf){
$.post($(this).attr('href'),
{ "ajx": true },
function(data){
if(data.scs){
/*this piece of code is not working*/
$(this).closest('tr').remove();
/*this piece of code is not working*/
//alert("ticket was deleted");
}
else{
alert("Error:: Ticket could not be deleted."+data.msg);
}
}, "json");
//alert('the requested ticket was deleted.');
}
//alert();
return false;
}
);
}
);
i have a table and i want to delete the row containing the link which was clicked.
the table row is as
<?php while($row = mysql_fetch_assoc($result)): ?>
<tr>
<td><?php echo ++$count; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['eventname']; ?></td>
<td>
<div class="img">
<img class='event' src="../upload/<?php echo $row['image']; ?>" alt="<?php echo $row['image']; ?>"/>
</div>
</td>
<td><?php echo $row['status']; ?></td>
<td><?php echo $row['date']; ?></td>
<td><a href="addticket.php?action=edit&tid=<?php echo $row['id']; ?>">edit</a></td>
<td><a class="delete" href="deleteticket.php?tid=<?php echo $row['id']; ?>" href="#">delete</a></td>
</tr>
<?php endwhile; ?>
UPDATE:: In my firebug console i get error message
g.nodeName is undefined
[Break On This Error] "first")return true;m=g;case "last":fo...Type===1||g.nodeName.toLowerCase()===
1 Answer