mirror of
https://github.com/actix/actix-website
synced 2025-06-29 16:24:58 +02:00
Updates front-page examples: powerful-extractor and easy-form-handling.
This commit is contained in:
36
examples/front-page/powerful-extractors/static/form.html
Normal file
36
examples/front-page/powerful-extractors/static/form.html
Normal file
@ -0,0 +1,36 @@
|
||||
<!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>
|
Reference in New Issue
Block a user