Html之在事件委派中发送Ajax请求获取当前元素并删除

来源:互联网 发布:淘宝商品管理在哪 编辑:程序博客网 时间:2024/06/17 05:30
//删除当前问题$('#question_list').on('click', '.delete_question', function (ev) {    if ($(this).parent().attr('ql') === undefined){        $(this).parent().remove();        return;    }    if($(this).parent().attr('ql') !== undefined){        $.ajax({        url: '/delete_question/?id=' + $(this).parent().attr('ql'),        type: 'get',        success: function (data) {            if (data['isDeleted']) {                //问题数据被删                $(ev.target).parent().parent().remove()            }        }    })    }});
阅读全文
1 0
原创粉丝点击