Reseting Table After AJAX Call

Reseting Table After AJAX Call

so I'm implementing a search functionality powered by an AJAX requests on this site here

http://polypodhub.com/ISL/

You can notice that when you start typing in the input, the AJAX call starts fetching the file names. So for instance if you type "S" it will fetch all the file names that have "S" in them. Now what I'm having trouble with is what happens after you delete your search query. What I would like to happen is for the table under the London category to reappear, but the AJAX request is deleting it.

Any idea as to what I should do to reset things when the input field is empty?

This is my AJAX request

  1.     <?php
  2.     $section='downloads';
  3.     $table="downloads";
  4.     $schoolSelectorTable="downloadsinschool";
  5.     $schoolSelector="downloads";
  6.     $folder="../../downloads/";
  7.    
  8.    
  9.         $db_host = "localhost";
  10.         $db_user = "root";
  11.         $db_pass = "";
  12.         $db_name = "isl";
  13.    
  14.    
  15.     mysql_connect($db_host, $db_user, $db_pass, $db_name);
  16.     mysql_select_db("isl") or die(mysql_error());
  17.    
  18.     $partialStates = $_POST['partialState'];
  19.     $states = mysql_query("SELECT * FROM `downloads` LEFT JOIN `downloadsinschool` ON `downloads`.`id`=`downloadsinschool`.`downloads` WHERE `school` = 2 AND `title` LIKE '%$partialStates%'" );
  20.    
  21.    
  22.     if($_POST['partialState']){
  23.    
  24.     while($state = mysql_fetch_array($states)){
  25.         echo "<tr><td class='tlong'>".$state['title']."</td></tr>";
  26.     }
  27.     }
  28.    
  29.     ?>