Step 5

Let's put in place the process for conducting a search.

Add the following to script.js

function search() {
  const query = document.getElementById("query").value.trim();
  const school = document.getElementById("schools").value;
  const term = document.getElementById("terms").value;

  console.log(`search for ${query} in the ${school} during ${term}`);
}

document.getElementById("searchBtn").addEventListener("click", search);

The search function gets the data it needs (namely the selected "school", "term", and search query) and as of now it simply prints them out to the console. We will later update this function to send a request to SIS API and return its response.

Notice the search function is called when the search button is clicked.