$(function() {

  $("#student-searchbar").autocomplete({
    source: function(request, response) {
      $.ajax({
        url: "/students/names",
        data: {
          q: request.term
        },
        success: function(data) {
          response(data);
        }
      });
    },
    focus: function(e, ui) {
      e.preventDefault();
      $(this).val(ui.item.label);
    },
    select: function(e, ui) {
      e.preventDefault();
      window.location.pathname = '/students/' + ui.item.value;
    },
  });

});

@@ -222,24 +222,143 @@
 ion(data) %7B%0A
+%0A          if (data.length === 0) %7B%0A            data = %5B%7B label: 'No matching students', value: null %7D%5D;%0A          %7D;%0A%0A
           re
@@ -546,24 +546,121 @@
 tDefault();%0A
+%0A      if (ui.item.label === 'No matching students') %7B%0A        $(this).val('');%0A      %7D else %7B%0A  
       window
@@ -710,16 +710,25 @@
 .value;%0A
+      %7D%0A%0A
     %7D,%0A 

Make student searchbar noisier when there are no results