jQuery(document).ready(function($) {
    $('.propdb_search_button').on('click', function() {
        const searchContainer = $(this).parent();
        const itemContainer = $(this).parent().next();
        console.log(searchContainer);

        const search_term = searchContainer.find('#propdb_search').val();
        const search_content = searchContainer.find('#propdb_search_content').val();
        const search_atts = searchContainer.find('#propdb_search_atts').val();

        const data = {
            action: 'propdb_search',
            search_term: search_term,
            search_content: search_content,
            search_atts: search_atts
        };

        $.post(pd_search.ajaxurl, data, function(response) {
            itemContainer.html(JSON.parse(response));
        });
    });
});
