$("#searchbutton").click(function(){ const audid = document.getElementById('auditory') $.ajax({ url: "/searchonaud", type: "get", contentType: 'application/json', dataType: 'json', data: { auditory: audid.value }, success: function(response){ var data = response; const table = document.getElementById('datatable') table.innerHTML = '' var headTable = '