-
-
Notifications
You must be signed in to change notification settings - Fork 424
/
Copy pathclient.html
42 lines (38 loc) · 1.14 KB
/
client.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
<html>
<head>
<title>ESC POS</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
</head>
<body>
<div class="container" style="width: 50%;">
<h1>ESC POS</h1>
<form onsubmit="handlePrint()">
<div class=" form-group">
<label>Server</label>
<input class="form-control" id="server" value="http://localhost:4000">
</div>
<div class="form-group">
<label>Text</label>
<input class="form-control" id="text" value="Hello World!">
</div>
<button o class=" btn btn-primary">Print</button>
</form>
</div>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</body>
</html>
<script>
function handlePrint() {
event.preventDefault()
server = document.getElementById("server").value
text = document.getElementById("text").value
axios.post(`${server}/print`, { "text": text })
.then(function (response) {
alert(response.data.status)
})
.catch(function (error) {
alert(error)
});
}
</script>