Attention: The Collaboratory IAM will down for up to 1 hour on Monday, the 7th of July 2025 starting from 5pm CEST (my timezone) for up to 1 hour. Any and all services, which require a user login with an EBRAINS account, will be un-available during that time


Last modified by marissadiazpier on 2023/09/04 17:22

From version 5.1
edited by marissadiazpier
on 2023/06/25 18:01
Change comment: There is no comment for this version
To version 10.1
edited by marissadiazpier
on 2023/06/25 18:10
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -51,39 +51,33 @@
51 51      </form>
52 52    </div>
53 53  
54 -  <script>
55 -    function handleDocumentSaved(response) {
56 -      console.log('Documento guardado con éxito:', response);
57 -    }
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();
58 58  
59 -    function saveResultsToOnlyOffice(results) {
60 -      window.onEditorsReady = function() {
61 -        window.Asc.documentService.upload(
62 -          {
63 -            url: 'https://drive.ebrains.eu/',
64 -            file: results,
65 -            callbackUrl: 'https://drive.ebrains.eu/smart-link/58102a22-49fc-426b-ae8c-daa107489e58/',
66 -            token: '58102a22-49fc-426b-ae8c-daa107489e58',
67 -            success: handleDocumentSaved,
68 -            error: function(response) {
69 -              console.log('Error al guardar el documento:', response);
70 -            }
71 -          }
72 -        );
73 -      };
74 -    }
60 + var selectedOption = $('input[name="option"]:checked').val();
61 + var results = "Has seleccionado: " + selectedOption;
75 75  
76 -    document.getElementById('survey-form').addEventListener('submit', function(event) {
77 -      event.preventDefault();
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>
78 78  
79 -      var selectedOption = document.querySelector('input[name="option"]:checked').value;
80 -      var results = "Has seleccionado: " + selectedOption;
81 -
82 -      saveResultsToOnlyOffice(results);
83 -    
84 -     Puedes hacer más acciones aquí, como mostrar un mensaje de agradecimiento o redireccionar al usuario a otra página
85 -    });
86 -  </script>
87 87  </body>
88 88  </html>
82 +
89 89  {{/html}}
Public

SLU_HBPB