Wiki source code of 25.06
Version 10.1 by marissadiazpier on 2023/06/25 18:10
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{html}} | ||
2 | <!DOCTYPE html> | ||
3 | <html> | ||
4 | <head> | ||
5 | <title>Encuesta</title> | ||
6 | <script src="https://api.onlyoffice.com/editors/callback.js"></script> | ||
7 | <style> | ||
8 | /* Estilos CSS para la encuesta */ | ||
9 | .container { | ||
10 | width: 400px; | ||
11 | margin: 50px auto; | ||
12 | } | ||
13 | |||
14 | h1 { | ||
15 | text-align: center; | ||
16 | } | ||
17 | |||
18 | form { | ||
19 | margin-top: 20px; | ||
20 | } | ||
21 | |||
22 | label { | ||
23 | display: block; | ||
24 | margin-bottom: 10px; | ||
25 | font-weight: bold; | ||
26 | } | ||
27 | |||
28 | input[type="radio"] { | ||
29 | margin-right: 5px; | ||
30 | } | ||
31 | |||
32 | input[type="submit"] { | ||
33 | margin-top: 10px; | ||
34 | } | ||
35 | </style> | ||
36 | </head> | ||
37 | <body> | ||
38 | <div class="container"> | ||
39 | <h1>Encuesta</h1> | ||
40 | <form id="survey-form"> | ||
41 | <label> | ||
42 | <input type="radio" name="option" value="option1"> Opción 1 | ||
43 | </label> | ||
44 | <label> | ||
45 | <input type="radio" name="option" value="option2"> Opción 2 | ||
46 | </label> | ||
47 | <label> | ||
48 | <input type="radio" name="option" value="option3"> Opción 3 | ||
49 | </label> | ||
50 | <input type="submit" value="Enviar"> | ||
51 | </form> | ||
52 | </div> | ||
53 | |||
54 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> | ||
55 | <script> | ||
56 | $(document).ready(function() { | ||
57 | $('#survey-form').submit(function(event) { | ||
58 | event.preventDefault(); | ||
59 | |||
60 | var selectedOption = $('input[name="option"]:checked').val(); | ||
61 | var results = "Has seleccionado: " + selectedOption; | ||
62 | |||
63 | // Realizar una solicitud AJAX al servidor para guardar los datos en el archivo en la nube | ||
64 | $.ajax({ | ||
65 | url: 'https://drive.ebrains.eu/smart-link/2052546c-45e8-4d51-847a-fa421a62e57b/', | ||
66 | type: 'POST', | ||
67 | data: results, | ||
68 | success: function(response) { | ||
69 | alert('Datos guardados exitosamente en el archivo en la nube.'); | ||
70 | }, | ||
71 | error: function(xhr, status, error) { | ||
72 | console.error(error); | ||
73 | alert('Error al guardar los datos en el archivo en la nube.'); | ||
74 | } | ||
75 | }); | ||
76 | }); | ||
77 | }); | ||
78 | </script> | ||
79 | |||
80 | </body> | ||
81 | </html> | ||
82 | |||
83 | {{/html}} |