Proyectos de Subversion Moodle

Rev

Rev 362 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 362 Rev 363
Línea -... Línea 1...
-
 
1
require(["jquery"], function ($) {
-
 
2
  $(document).ready(function ($) {
-
 
3
    $(".btn-cesa-course-completion").click(function (e) {
1
const $ = require("jquery");
4
      var url = $(this).data("url");
Línea 2... Línea -...
2
 
-
 
3
$(document).ready(function ($) {
-
 
4
  $(".btn-cesa-course-completion").click(function (e) {
-
 
5
    var url = $(this).data("url");
-
 
6
 
5
 
7
    $.ajax({
6
      $.ajax({
8
      dataType: "json",
7
        dataType: "json",
9
      accept: "application/json",
8
        accept: "application/json",
10
      method: "get",
9
        method: "get",
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
        }
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
          }
19
      })
18
        })
20
      .fail(function (jqXHR, textStatus, errorThrown) {
19
        .fail(function (jqXHR, textStatus, errorThrown) {
21
        alert(response.data);
20
          alert(response.data);
-
 
21
        });
22
      });
22
    });
23
  });
23
  });