1 | <!DOCTYPE html> |
2 | <html lang="es"> |
3 | |
4 | <head> |
5 | |
6 | <meta charset="UTF-8"> |
7 | <meta name="viewport" content="width=device-width"> |
8 | |
9 | <title>Servicio que procesa un formulario con token</title> |
10 | |
11 | <script type="module" src="lib/js/invocaServicio.js"></script> |
12 | <script type="module" src="lib/js/submitForm.js"></script> |
13 | <script type="module" src="lib/js/muestraError.js"></script> |
14 | |
15 | <script> |
16 | |
17 | let token = "" |
18 | |
19 | </script> |
20 | |
21 | </head> |
22 | |
23 | |
24 | |
25 | <body onload="invocaServicio('srv/srvRegistra.php') |
26 | .then(token => forma.token.value = token.body) |
27 | .catch(muestraError)"> |
28 | |
29 | <h1>Servicio que procesa un formulario con token</h1> |
30 | |
31 | <p><a href="index.html">Cancela</a></p> |
32 | |
33 | <form id="forma" onsubmit="submitForm('srv/srvProcesa.php', event) |
34 | .then(resultado => { |
35 | alert(resultado.body) |
36 | location.href = 'index.html' |
37 | }) |
38 | .catch(muestraError)"> |
39 | |
40 | |
41 | <input type="hidden" name="token"> |
42 | |
43 | <p> |
44 | <label> |
45 | Saludo: |
46 | <input name="saludo"> |
47 | </label> |
48 | </p> |
49 | |
50 | <p> |
51 | <label> |
52 | Nombre: |
53 | <input name="nombre"> |
54 | </label> |
55 | </p> |
56 | |
57 | <p><button type="submit">Procesa</button></p> |
58 | |
59 | </form> |
60 | |
61 | </body> |
62 | |
63 | </html> |