$(document).ready(function() { /** * AJAX Beer Search Filter */ $("#beer-search").keyup(function() { var content = $("#beer-search").val(); if(content.length >= 0) { $.getJSON("/beers/search", {"value": content}, function(data) { $("#beer-table tbody tr").remove(); for(var i=0;i"+data[i].name+""; html += "To Brewery"; html += ""; html += "Edit\n"; html += "Delete"; html += ""; html += ""; $("#beer-table tbody").append(html); } }); } }); /** * AJAX Brewery Search Filter */ $("#brewery-search").keyup(function() { var content = $("#brewery-search").val(); if(content.length >= 0) { $.getJSON("/breweries/search", {"value": content}, function(data) { $("#brewery-table tbody tr").remove(); for(var i=0;i"+data[i].name+""; html += ""; html += "Delete"; html += ""; html += ""; $("#brewery-table tbody").append(html); } }); } }); });