Delete current row in a <table> with jQuery
- by omgkurtnilsen
I have a table that lists a bunch of customers. The last cell is an ajax delete button.
I want the row containing the deleted customer to be deleted through jQuery.
<table>
<tr><td>Customer info 1</td><td><a href="javascript:deleteCustomer(1);">Delete</a></td>
<tr><td>Customer info 2</td><td><a href="javascript:deleteCustomer(2);">Delete</a></td>
function deleteCustomer(customerId)
{
$.post("somepage.php", {cid:customerId}, function(data){
//...delete the row that called the function...
}