Spaces:
Sleeping
Sleeping
Create templates/index.html
Browse files- templates/index.html +35 -0
templates/index.html
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Timer App</title>
|
| 7 |
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
| 8 |
+
</head>
|
| 9 |
+
<body>
|
| 10 |
+
<h1>Timer App</h1>
|
| 11 |
+
<div>
|
| 12 |
+
<label for="seconds">Set Timer (seconds): </label>
|
| 13 |
+
<input type="number" id="seconds" name="seconds" min="1" max="600" required>
|
| 14 |
+
<button id="start_button">Start Timer</button>
|
| 15 |
+
</div>
|
| 16 |
+
<div id="timer_output"></div>
|
| 17 |
+
|
| 18 |
+
<script>
|
| 19 |
+
// Start timer function
|
| 20 |
+
$("#start_button").click(function() {
|
| 21 |
+
let seconds = $("#seconds").val();
|
| 22 |
+
|
| 23 |
+
// Send a request to start the timer
|
| 24 |
+
$.ajax({
|
| 25 |
+
url: "/start_timer",
|
| 26 |
+
method: "POST",
|
| 27 |
+
data: {seconds: seconds},
|
| 28 |
+
success: function(response) {
|
| 29 |
+
$("#timer_output").text(response.message);
|
| 30 |
+
}
|
| 31 |
+
});
|
| 32 |
+
});
|
| 33 |
+
</script>
|
| 34 |
+
</body>
|
| 35 |
+
</html>
|