遍历完分类,然后想通过分类的id来删除,但是如何在点击以后获得分类的id呢?
回复讨论(解决方案)
没看明白,在发点代码,
你可以参考用在每个分类后面加一个删除的按钮,或者用复选框,选中的直接删除..
没看明白,在发点代码,
你可以参考用在每个分类后面加一个删除的按钮,或者用复选框,选中的直接删除..
|
编辑分类 删除分类 |
确认要删除这个分类吗?
注意:当前分类下的所有商品都会被删除!
In this way, the id will only be the last id, and I hope he can pass the id. .
It depends on your needs. If you accept the jump form, you can directly write delete.php?id= in the href, and pass it over The get value id is what you want to delete. If you delete it through asynchronous ajax processing of js, you canDelete category Here I added two attributes, class and value
$('.del').click(function(){
var id= $(this).attr('value');
$.post('delete.php',{id:id},function(data){
if(data==1){
Alert ('Delete success!);
}
})
})
The method written by jquery, if you change it with the native JS landlord, it is a click event.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn