Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>FastAPI получение данных из объектов.</title>
- <meta charset="utf-8" />
- </head>
- <body>
- <div id="message"></div>
- <button onclick="send()">Отправить</button>
- <script>
- async function send() {
- const response = await fetch("/hello", {
- method: "POST",
- headers: { "Accept": "application/json", "Content-Type": "application/json" },
- body: JSON.stringify([
- { name: "Tom", age: 38 },
- { name: "Bob", age: 41 },
- { name: "Sam", age: 25 }
- ])
- });
- const data = await response.json();
- console.log(data);
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement