ajax prevent duplicate submission form

<div class="btn-wrap">

<div id="btn" class="btn">提交</div>
</div>

 

.ajax $ ({
type: 'POST',
URL: '../../../ Maintain / addConsult',
dataType: 'JSON',
Data: {title: title, Question: Question, Check1: Check1, the check2 : check2, the above mentioned id: the above mentioned id},
the async: false,
beforeSend: function () {
. 1 // let the submit button fails to achieve prevent repeat button click
$ ( "btn.") attr ( 'disabled', true);.
// 2 to provide the user-friendly status prompt
$ ( "btn.") text ( ' submission ...');.
},
Complete: function () {
// 3 button again to make effective landing.
$ (. " . BTN ") removeAttr ( 'Disabled');
},
Success: function (Data) {
IF (Data> 0) {
//sessionStorage.setItem('jump ',' Jump ');
window.history.back (-1 );
} the else {
Alert ( "Advisory failed");
}
}
})

Guess you like

Origin www.cnblogs.com/siyuan7657/p/12073947.html