1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 23:20:51 +00:00

Disable button when perform ajax post

This commit is contained in:
zhengxie
2012-10-12 21:11:30 +08:00
parent 7e66170f48
commit 6cd0df1a1d
5 changed files with 26 additions and 1 deletions

View File

@@ -21,6 +21,8 @@ $('#encrypt-switch').click(function () {
$('#repo-create-submit').click(function() {
var passwd = $('#repo-create-form input[name="passwd"]'),
passwd_again = $('#repo-create-form input[name="passwd_again"]');
var self = $(this);
self.attr('disabled', 'disabled');
$.ajax({
url: '{{ post_url }}',
@@ -43,6 +45,7 @@ $('#repo-create-submit').click(function() {
location.reload(true);
} else {
apply_form_error('repo-create-form', data['error']);
self.removeAttr('disabled');
}
},
error: function(data, textStatus, jqXHR) {
@@ -50,6 +53,7 @@ $('#repo-create-submit').click(function() {
$.each(errors, function(index, value) {
apply_form_error('repo-create-form', value[0]);
});
self.removeAttr('disabled');
}
});