Completely new to JQuery so I am learning everyday.
One thing I noticed is how easy it is, you can just write
$('div#test).remove();
But I am looking for an example on how to reuse some code, eg.:
function RemoveTableRow(row, id)
{
$(row).remove();
// id should be used for ajax call
}
And then add a 'onclick' on my anchor-tag
onclick="RemoveTableRow('user-row-1', 32);"
But somehow it is not working, even if I add it on document.ready function. Can someone cut it out for me, the best practice way for doing this?
Thanks in advance. This forum is killer!
Update
I updated the code from the help I got here. This is my current code, and I would like to know if its the best way of doing this.
function RemoveTableRow(row, id) {
$.ajax({
type: "POST",
url: "Default.aspx/DeleteEmployee",
data: "{'ID':'" + id + "'}",
beforeSend: function() {
$("#" + row).animate({'backgroundColor':'#fb6c6c'},300);
},
success: function() {
$("#" + row).slideUp(300,function() {
$("#" + row).remove();
});
}
});
}