how can a fetch a particular content from a row in w开发者_运维百科hich the row contents product name,barcode,quantity and buy price.I am to delete the particular row by using this jquery
$('#Delete').live('click',function(row) {
$(this).closest("tr").removeClass("selected");
$(this).addClass("selected");
/**/
var href = $(this).attr('href');
$(this).closest('tr').toggleClass('highlight');
$('tr').click(function(){$(this).effect("highlight", {}, 3000);});
var button = $(this);
var ok=confirm("You really want to delete?");
if(ok)
{
$(this).closest("tr").remove(); // remove row
}
return false; // prevents default behavior
});
IM using this function for that:
function todoDelete(id) {
$.ajax({
url: '/todo/delete/' + id,
success: function() {
$('#update_' + id).css('backgroundColor', '#ff6666');
$('#update_' + id).fadeOut(250);
}
});
}
But you can modifie as that:
$('a.delete').click(function(link){
var row = $(link).parent('tr');
var id = row.children('td.id').html(); // append id class, there is your id
$.ajax({
url: '/delete/' + id,
success: function() {
row.css('backgroundColor', '#ff6666');
row.fadeOut(250);
}
});
}
精彩评论