| $(document).ready(function(){
    
    $('.inpSearch').keyup(
        function(){
            //let input = $(this);
            let text = $(this).val();
            if(text != ''){
                $.ajax({
                    url:     "php/search.php", 
                    type:     "POST",
                    dataType: "json", 
                    data:{
                        referal: text
                    },  
                    success: function(response) {
                        if(response.error){
                            $('.listUsers').children().remove();
                            let str=`<div class="nothing">?????? ?? ???????</div>`;
                            $(".listUsers").append(str);
                        } else {
                            $('.listUsers').children().remove();
                            response.forEach(title => {
                                let str=`<a href="../pic.php?id=${title.id}"><div class="divSPic"><img class="spic" src="${title.path}"><div class="title">${title.title}</div></div></a>`;
                                $(".listUsers").append(str);
                            });
                        }
                    }
                });
            }  else {
                $('.listUsers').children().remove();
            }
        }
    );
    //????? ?????
    // $('.inpSearch').bind("change keyup input click", function() {
    //     if(this.value.length >= 2){
    //         $.ajax({
    //             type: 'post',
    //             url: "../php/search.php", //???? ? ???????????
    //             d?ta: {'referal':this.value},
    //             response: 'text',
    //             success: function(data){
    //                 $(".search_result").html(data).fadeIn(); //??????? ????????? ?????? ? ??????
    //            }
    //        })
    //     }
    // })
        
    // $(".search_result").hover(function(){
    //     $(".inpSearch").blur(); //??????? ????? ? input
    // })
        
    // //??? ?????? ?????????? ??????, ?????? ?????? ? ??????? ????????? ????????? ? input
    // $(".search_result").on("click", "li", function(){
    //     s_user = $(this).text();
    //     //$(".who").val(s_user).attr('disabled', 'disabled'); //???????????? input, ???? ?????
    //     $(".search_result").fadeOut();
    // })
})
 |