Debian Codegraph @

examples/post/index.html

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 <!doctype html>
2 <html>
3
4 <head>
5 <title>axios - post example</title>
6 <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
7 </head>
8
9 <body class="container">
10 <h1>axios.post</h1>
11
12 <form role="form" class="form" onsubmit="return false;">
13 <div class="form-group">
14 <label for="data">JSON</label>
15 <textarea id="data" class="form-control" rows="5"></textarea>
16 </div>
17 <button id="post" type="button" class="btn btn-primary">POST</button>
18 </form>
19
20 <div id="output" class="container"></div>
21
22 <script src="/axios.min.js"></script>
23 <script>
24 (function () {
25 var output = document.getElementById('output');
26 document.getElementById('post').onclick = function () {
27 var data = document.getElementById('data').value;
28
29 axios.post('/post/server', JSON.parse(data))
30 .then(function (res) {
31 output.className = 'container';
32 output.innerHTML = res.data;
33 })
34 .catch(function (err) {
35 output.className = 'container text-danger';
36 output.innerHTML = err.message;
37 });
38 };
39 })();
40 </script>
41 </body>
42
43 </html>