Sugar for comment sending.
- Do not send if comment empty - Disable submit button while submit is in progress
This commit is contained in:
parent
22253b4e68
commit
bb37d16dff
@ -49,6 +49,8 @@ $(document).ready(function () {
|
||||
form.submit(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
if ($('#comment').val()) {
|
||||
$('#add_comment').attr("disabled", "disabled");
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: form.attr('action'),
|
||||
@ -57,7 +59,6 @@ $(document).ready(function () {
|
||||
success: function(data)
|
||||
{
|
||||
$('#comment').val('');
|
||||
|
||||
if (data.result) {
|
||||
$('#comments_list')
|
||||
.replaceWith(data.comments);
|
||||
@ -81,8 +82,12 @@ $(document).ready(function () {
|
||||
scrollTop: commentsAlert.offset().top
|
||||
}, 750);
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$('#add_comment').removeAttr("disabled");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user