-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfront.html
32 lines (29 loc) · 853 Bytes
/
front.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
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
<title>Text Filtering API Demo</title>
<script src="index.js"></script>
</head>
<body>
<h1>Text Filtering API Demo</h1>
<textarea id="inputText" rows="4" cols="50"></textarea>
<br>
<button id="filterButton">Filter Text</button>
<div id="filteredText"></div>
<script>
document.getElementById('filterButton').addEventListener('click', async () => {
const inputText = document.getElementById('inputText').value;
const response = await fetch('./filter', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ text: inputText })
});
const data = await response.json();
document.getElementById('filteredText').textContent = data.filteredText;
});
</script>
</body>
</html>