Delete current row in a <table> with jQuery

Posted by omgkurtnilsen on Stack Overflow See other posts from Stack Overflow or by omgkurtnilsen
Published on 2010-05-31T19:43:33Z Indexed on 2010/05/31 20:03 UTC
Read the original article Hit count: 188

Filed under:
|

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...
}

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery