php - Reset results if filter input is empty -


i created simple search type replaces div (which populated php). function works fine. cannot reset original state if input field blank.

here script:

$("#search_user").keyup(function()   {   var search_user = $(this).val();   var datastring = 'keyword='+ search_user;   if(search_user.length>3)   {   $.ajax({   type: "get",   url: "../functions/search.php",   data: datastring,   success: function(server_response)         {           $('#list_users').html(server_response);         }   });   }   return false; }); 

original div code:

    <div id="list_users">    <?php echo "           <div class=\"col-md-3\">             <img src=\"../assets/img/avatars/1.jpg\" class=\"user-avatar\">             <div class=\"caption\">               <h5>$rows[user_full_name] <br> <small> designer</small></h5>             </div>           </div>        " ;?>            </div> 

thank you.

you mean

var $copy = $("#list_users").html(); $("#search_user").keyup(function() {   var search_user = $(this).val();   if(search_user=="") $("#list_users").html($copy);   else { 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -