Back to all resources
Fetch API
Greenhouse API
Job Listings
Filtering

Greenhouse

By Ben Parker
This JavaScript code initializes and manages job listings fetched from the Greenhouse API. It first defines a global object, domElements, to store references to various DOM elements used in the script. The fetchData function is a utility for making API requests and handling errors. The domElements.jobFilter.onchange event listener filters job listings based on user selection. The initJob function starts by displaying a loading indicator, fetching department data from the Greenhouse API, and creating DOM elements for each department. It also populates a dropdown filter with department options. Finally, the writeJobs function retrieves and displays jobs for each department, removing the loading indicator and placeholder elements once the data is fully loaded. The script ends by calling initJob to kick off the data fetching and rendering process.