mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-01-03 14:19:54 +01:00
Upgrade scalatra-forms to support Ajax request.
This commit is contained in:
Binary file not shown.
@@ -13,16 +13,20 @@ function validate(e){
|
||||
|
||||
$.post(form.attr('action') + '/validate', $(e.target).serialize(), function(data){
|
||||
// clear all error messages
|
||||
$('.error').text('');
|
||||
$('.error-message').text('');
|
||||
|
||||
if($.isEmptyObject(data)){
|
||||
form.data('validated', true);
|
||||
form.submit();
|
||||
} else {
|
||||
$.each(data, function(key, value){
|
||||
$('#error-' + key).text(value);
|
||||
});
|
||||
displayErrors(data);
|
||||
}
|
||||
}, 'json');
|
||||
return false;
|
||||
}
|
||||
|
||||
function displayErrors(data){
|
||||
$.each(data, function(key, value){
|
||||
$('#error-' + key).text(value);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user