Passed
Push — master ( 8f0aa9...1c3a2b )
by Brayan
02:00
created

views/app/js/register/register.js (2 issues)

Languages
Severity
1
/**
2
 * Ajax action to api rest
3
*/
4
function register(){
5
  $.ajax({
6
    type : "POST",
7
    url : "api/register",
8
    data : $('#register_form').serialize(),
9
    success : function(json) {
10
      alert(json.success);
11
      alert(json.message);
12
      if(json.success == 1) {
13
        setTimeout(function(){
14
            location.reload();
15
        },1000);
16
      }
17
    },
18
    error : function(/*xhr, status*/) {
19
      alert('Ha ocurrido un problema.');
20
    }
21
  });
22
}
23
24
/**
25
 * Events
26
 */
27
$('#register').click(function(e) {
28
  e.defaultPrevented;
0 ignored issues
show
The result of the property access to e.defaultPrevented is not used.
Loading history...
29
  register();
30
});
31
$('#register_form').keypress(function(e) {
32
    e.defaultPrevented;
0 ignored issues
show
The result of the property access to e.defaultPrevented is not used.
Loading history...
33
    if(e.which == 13) {
34
        register();
35
    }
36
});
37