关于div的jQuery AJAX在另一个div上的jQuery AJAX之后无法正常工作

I have a page with 2 divs..each div have to call an ajax function on load. However, after I open either one of the divs, the ajax of the other div will not work.

*#div_remove lets the user delete a user from the system and display the existing ones in another div within #div_remove thru ajax.

#div_logs displays all transactions done in the system and displays them on another div within #div_logs through ajax.*

Here is the jQuery code:

$("#remove_admin").on("click",function(){
        $("#light").fadeIn("slow");
        $("#div_remove").slideDown("slow");
        showtable();
        event.preventDefault();

        $("#btnRemove").click(function(){
            var text = $.ajax ({
                type: "GET",
                url: "delUserProcess.php?keyword="+$("#txtRemove").val()+"&table=users&field=username",
                async: false,
            }).responseText;
            alert(text);
            showtable();
            event.preventDefault();
        });

    });

    //VIEW USER LOGS
    $("#logs").on("click",function(){
        $("#light").fadeIn("slow");
        $("#div_logs").slideDown("slow");
        showLogs(); 
        event.preventDefault();
    });

    $("#txtUser").on("keyup",function(){
        showLogs(); 
        event.preventDefault();
    });

    $(".date").on("change",function(){
        showLogs(); 
        event.preventDefault();
    });

});

function showtable(){
    $.ajaxSetup ({  
    cache: false  
}); 
    $.ajax({
        type: "GET",
        url: "showAdmin.php",
        async: false,
        success:function(text){
            $("#tblUsers").html(text);
        }
    });

}

function showLogs(){
    $.ajaxSetup ({  
    cache: false  
}); 
    var cBy = $("#txtUser").val();
    var sDate = $("#startDate").val();
    var eDate = $("#endDate").val();


    $.ajax({
        type: "GET",
        url: "showLogs.php?sDate="+sDate+"&eDate="+eDate+"&createdBy="+cBy,
        async: false,
        success: function(text){
            $("#tblHistory").html(text);
        }
    });

}`

the original code used .click(), .keyup() and .change().. I already tried using .live() and .on() but it is still not working. please help.

You need to bind the events under the showLogs file. Because whenever you call the delete or other events, it replace the html with the updated one. and the events lots it existance. So you need to call them in the showLogs file.