ajax delete,AJAX delete - using jQuery

博主正在尝试在ASP页面上实现一个购物车功能,允许用户通过点击图片删除购物车中的商品条目。目前,他们已经成功实现了后台删除操作,但遇到了问题:当使用Ajax进行删除时,点击一行的删除按钮会导致所有行被移除。博主寻求帮助以解决如何针对每一行独立设置Ajax删除功能,以便只删除被点击的那一行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I have a simple cart page that displays items that are in someones cart, and having it display via an ASP while from my table. I have a column where a user can delete an entry. I have the ASP working properly, now I am trying to add some AJAX in to it. I have the following code:

$("img.delete").click(function() {

var id = $('#id').attr('value');

$.ajax({

type: "POST",

url: "delete.php",

data: "id="+ id,

success: function(){

$('tr.selector').remove();

$('div.success').fadeIn();

}

});

return false;

});

The thing is, how wouild I go about setting it up for each value, because if I use the above, I click one and they will all go. I am confused on how to set it up to work with numerous rows.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值