汉源最新招聘信息网 (汉源最新招聘信息)

武汉桑拿 04-28 阅读:37 评论:0
汉源最新招聘信息网 (汉源最新招聘信息)

最新招聘信息

Copyright © 2023 汉源最新招聘信息网

js (function () {const jobListings = document.getElementById('job-listings');const jobTitleInput = document.getElementById('job-title');const locationInput = document.getElementById('location');const companyInput = document.getElementById('company');// 从服务器获取招聘信息const getJobs = (searchTerm) => {const params = new URLSearchParams();if (searchTerm) params.append('q', searchTerm);fetch('api/jobs?' + params.toString()).then(res => res.json()).then(data => {jobListings.innerHTML = '';data.forEach(job => {const li = document.createElement('li');const a = document.createElement('a');a.href = job.url;a.textContent = job.title;const p = document.createElement('p');p.textContent = `${job.location} - ${job.company}`;li.appendChild(a);li.appendChild(p);jobListings.appendChild(li);})}).catch(err => {console.error(err)alert('抱歉,获取招聘信息时出错!')})}// 提交搜索表单const searchForm = document.getElementById('job-search');searchForm.addEventListener('submit', (e) => {e.preventDefault();// 收集搜索词const searchTerm = `${jobTitleInput.value} ${locationInput.value} ${companyInput.value}`.trim();if (searchTerm) {getJobs(searchTerm);} else {alert('请至少输入一个搜索条件!')}})// 页面加载时获取所有招聘信息getJobs(); })()
版权声明

本文仅代表作者观点,不代表武汉桑拿立场。
本文系作者授权发表,未经许可,不得转载。