Proyectos de Subversion Moodle

Rev

Rev 363 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 363 Rev 364
Línea -... Línea 1...
-
 
1
try {
1
require(["jquery"], function ($) {
2
  require(["jquery"], function ($) {
2
  $(document).ready(function ($) {
3
    $(document).ready(function ($) {
3
    $(".btn-cesa-course-completion").click(function (e) {
4
      $(".btn-cesa-course-completion").click(function (e) {
4
      var url = $(this).data("url");
5
        var url = $(this).data("url");
Línea 5... Línea 6...
5
 
6
 
6
      $.ajax({
7
        $.ajax({
7
        dataType: "json",
8
          dataType: "json",
8
        accept: "application/json",
9
          accept: "application/json",
9
        method: "get",
10
          method: "get",
10
        url: url,
-
 
11
      })
-
 
12
        .done(function (response) {
-
 
13
          if (response.success) {
-
 
14
            window.location.href = response.data;
-
 
15
          } else {
-
 
16
            alert(response.data);
-
 
17
          }
11
          url: url,
-
 
12
        })
-
 
13
          .done(function (response) {
-
 
14
            if (response.success) {
-
 
15
              window.location.href = response.data;
-
 
16
            } else {
-
 
17
              alert(response.data);
-
 
18
            }
18
        })
19
          })
19
        .fail(function (jqXHR, textStatus, errorThrown) {
20
          .fail(function (jqXHR, textStatus, errorThrown) {
20
          alert(response.data);
21
            alert(response.data);
-
 
22
          });
21
        });
23
      });
22
    });
24
    });
-
 
25
  });
-
 
26
} catch (error) {
23
  });
27
  console.error(error.message);