-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathajax.js
More file actions
24 lines (24 loc) · 736 Bytes
/
Copy pathajax.js
File metadata and controls
24 lines (24 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$(document.forms['login-form']).on('submit', function() {
var form = $(this);
$('.error', form).html('');
$(":submit", form).button("loading");
$.ajax({
url: "/login",
method: "POST",
data: form.serialize(),
complete: function() {
$(":submit", form).button("reset");
},
statusCode: {
200: function() {
form.html("Вы вошли в сайт").addClass('alert-success');
window.location.href = "/";
},
403: function(jqXHR) {
var error = JSON.parse(jqXHR.responseText);
$('.error', form).html(error.message);
}
}
});
return false;
});