$(document).ready(function() {
    $("#search").keyup(function() {
        var name = $('#search').val().trim(); // Trim whitespace from the input
        if (name === "") {
            $("#display").html(""); // Clear the display if input is empty
        } else {
            $.ajax({
                type: "POST",
                url: "ajax.php",
                data: {
                    search: name
                },
                success: function(html) {
                    // Perform any additional validation or sanitization on the received HTML if necessary
                    $("#display").html(html).show();
                }
            });
        }
    });
});
