forked from albal/JobFinder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
118 lines (106 loc) · 3.43 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!-- index.html -->
<!DOCTYPE html>
<html lang="en-GB">
<head>
<meta charset="UTF-8">
<title>Remote and Outside IR35 Jobs</title>
<style>
/* Styles */
body {
font-family: Arial, sans-serif;
margin: 20px;
}
h1 {
color: #333;
}
form {
margin-bottom: 20px;
}
input[type="text"] {
padding: 8px;
width: 300px;
}
button {
padding: 8px 12px;
}
.job-listing {
border-bottom: 1px solid #ccc;
padding: 10px 0;
}
.job-title {
font-size: 18px;
font-weight: bold;
}
.job-company {
color: #555;
}
.job-description {
margin-top: 10px;
}
.no-results {
color: red;
}
</style>
</head>
<body>
<h1>Find Fully Remote and Outside IR35 Jobs in the UK</h1>
<form id="search-form">
<input type="text" id="keywords" placeholder="Enter keywords (e.g., Developer, Engineer)" required>
<button type="submit">Search</button>
</form>
<div id="results"></div>
<script>
document.getElementById('search-form').addEventListener('submit', async (e) => {
e.preventDefault();
const keywords = document.getElementById('keywords').value;
const resultsDiv = document.getElementById('results');
resultsDiv.innerHTML = 'Searching...';
try {
const response = await fetch(`/search?q=${encodeURIComponent(keywords)}`);
if (!response.ok) {
throw new Error('Network response was not ok');
}
const data = await response.json();
if (data.jobs && data.jobs.length > 0) {
resultsDiv.innerHTML = '';
data.jobs.forEach(job => {
const jobDiv = document.createElement('div');
jobDiv.className = 'job-listing';
const title = document.createElement('div');
title.className = 'job-title';
title.textContent = job.title;
const company = document.createElement('div');
company.className = 'job-company';
company.textContent = job.agency ? job.agency.title : 'Unknown Company';
const location = document.createElement('div');
location.className = 'job-location';
location.textContent = `Location: ${job.location || 'N/A'}`;
const salary = document.createElement('div');
salary.className = 'job-salary';
salary.textContent = `Salary: ${job.salary || 'N/A'}`;
const description = document.createElement('div');
description.className = 'job-description';
description.innerHTML = job.description || '';
const link = document.createElement('a');
link.href = `https://www.cv-library.co.uk${job.url}`;
link.target = '_blank';
link.textContent = 'View Job';
jobDiv.appendChild(title);
jobDiv.appendChild(company);
jobDiv.appendChild(location);
jobDiv.appendChild(salary);
jobDiv.appendChild(description);
jobDiv.appendChild(link);
resultsDiv.appendChild(jobDiv);
});
} else {
resultsDiv.innerHTML = '<div class="no-results">No jobs found matching your criteria.</div>';
}
} catch (error) {
console.error('Error fetching jobs:', error);
resultsDiv.innerHTML = '<div class="no-results">An error occurred while fetching jobs.</div>';
}
});
</script>
</body>
</html>