mirror of
https://github.com/nlepage/go-wasm-http-server.git
synced 2026-01-12 10:09:12 +00:00
24 lines
596 B
HTML
24 lines
596 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>go-wasm-http-server demo</title>
|
|
<script>
|
|
function hello() {
|
|
res=await fetch('api/hello', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({ name: document.querySelector("#name").value })
|
|
})
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<label for="name">Name : </label><input id="name" value="World">
|
|
<button onclick="hello">Hello</button>
|
|
<script>
|
|
navigator.serviceWorker.register('sw.js')
|
|
</script>
|
|
</body>
|
|
</html> |