Proyectos de Subversion Moodle

Rev

Rev 363 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
364 ariadna 1
try {
2
  require(["jquery"], function ($) {
3
    $(document).ready(function ($) {
4
      $(".btn-cesa-course-completion").click(function (e) {
5
        var url = $(this).data("url");
1 efrain 6
 
364 ariadna 7
        $.ajax({
8
          dataType: "json",
9
          accept: "application/json",
10
          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
            }
19
          })
20
          .fail(function (jqXHR, textStatus, errorThrown) {
363 ariadna 21
            alert(response.data);
364 ariadna 22
          });
23
      });
363 ariadna 24
    });
361 ariadna 25
  });
364 ariadna 26
} catch (error) {
27
  console.error(error.message);
28
}