34 lines
No EOL
994 B
HTML
34 lines
No EOL
994 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Add Task</title>
|
|
</head>
|
|
<body>
|
|
<h1>Add New Task</h1>
|
|
<form id="taskForm">
|
|
<div>
|
|
<label for="taskData">Task Data:</label>
|
|
<textarea id="taskData" name="taskData" required></textarea>
|
|
</div>
|
|
<button type="submit">Submit</button>
|
|
</form>
|
|
|
|
<script>
|
|
document.getElementById('taskForm').addEventListener('submit', async (e) => {
|
|
e.preventDefault();
|
|
const response = await fetch('/tasks', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'X-Client-Cert-User': '{{ user }}'
|
|
},
|
|
body: JSON.stringify({
|
|
data: document.getElementById('taskData').value
|
|
})
|
|
});
|
|
const result = await response.json();
|
|
alert(result.status || result.error);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |