1
我試圖禁用提交按鈕,直到ajax函數完成。禁用提交按鈕,直到Ajax完成
現在,我只能弄清楚如何在用戶輸入時禁用指定時間的按鈕。
如何禁用提交按鈕,直到ajax數據加載?謝謝。
<script>
$('#comment_comment').keyup(function() {
$("#new_comment_button").attr("disabled", true);
setTimeout(function() { $("#new_comment_button").removeAttr("disabled"); }, 2000);
});
$('#comment_comment').preview({ key:'my key',
selector : {type:'rich'},
preview : {
submit : function(e, data){
$.ajax({
dataType: 'script',
url: this.form.attr('action'),
type: 'POST',
data: data
});
},
},
autoplay : 0,
maxwidth : 350,
display : {display : 'rich'}
});
</script>