mirror of
https://github.com/actix/actix-website
synced 2024-11-24 08:43:01 +01:00
37 lines
783 B
HTML
37 lines
783 B
HTML
<!doctype htmtl>
|
|
<html>
|
|
<head>
|
|
<meta charset=utf-8>
|
|
<title>Forms</title>
|
|
</head>
|
|
|
|
<body>
|
|
<h3>Submit Json</h3>
|
|
|
|
<button onclick="submitJson()">Submit</button>
|
|
|
|
<script>
|
|
function submitJson() {
|
|
fetch('http://localhost:8000/event', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Accept': 'application/json',
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
timestamp: 12345,
|
|
kind: "this is a kind",
|
|
tags: ['tag1', 'tag2', 'tag3'],
|
|
})
|
|
})
|
|
.then(function (res) {
|
|
return res.text();
|
|
})
|
|
.then(function (data) {
|
|
console.log(data);
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|