开发者

jquery .live() function only works once

When I run this code it performs as it should the first time however when I try the action a second time nothing happens. any help is greatly appreciated.

$('.delete_user').live("click",function(){
var $id = $(this).attr('id');
    var $form = $('#member_search').serialize();
        $.post("server_code.php",{id: $id, form: $form},
            function(data){ 
            $('#member_row_container').html(data).show();
            $('.row_standard:odd').addClass('row_alternate');
        });
    $(".div_alert").hid开发者_如何转开发e();  
    $(".overlay").hide();
    return false;
    });   


I don't think it's entirely related to this, but you were sending data in the wrong format. Try this:

$('.delete_user').live('click', function(e){
    e.preventDefault();
    var form = $('#member_search').serialize(),
        data = 'id='+this.id+'&'+form;
    $.post('server_code.php', data, function(html){ 
        $('#member_row_container').html(html).show();
        $('.row_standard:odd').addClass('row_alternate');
    }, 'html');
    $(".div_alert").hide();  
    $(".overlay").hide();
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜