PHP Classes

File: js/search.js

Recommend this page to a friend!
  Classes of Ann   Purp Project   js/search.js   Download  
File: js/search.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Purp Project
Application to manage photo albums
Author: By
Last change: Update of js/search.js
Date: 1 year ago
Size: 2,588 bytes
 

Contents

Class file image Download
$(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(); // }) })