Recently in practice sign send an integrating function, can be found at the moment when submitting good cause can be repeated several times to receive multiple points in addition to increasing requests limit no limit to the findings ajax submit this post to resubmit Suili warning
First, the form code
<form onsubmit="return check_login()" style="text-align: center;margin-top:50px"> <input value="登 录" class="btn_submit" id="btn_submit" type="submit"> </form>
Form style code
.btn_submit { background-color: #e31436; color: #fff; cursor: pointer; display: inline-block; font-size: 18px; height: 44px; line-height: 44px; text-align: center; width: 200px; border-radius: 2px; border:none } .disabled{opacity: 0.5;cursor:default}
AJAX anti resubmit Code
check_login function () { IF ($ ( "# btn_submit") hasClass ( "Disabled").); // to avoid duplication it is determined whether the submission Disabled return to false; // return to false $ ( "# btn_submit"). addClass (. . "disabled") val ( "being presented"); // add to submit a first time to the class Disabled $ .post ( "the login.php", ID {:}. 1, function (Data) { $ ( "# btn_submit ") .removeClass (" disabled ". ) val (" login "); // after a successful return to cancel Disabled location.href =" http://www.sucaihuo.com/php/2747.html "; }," json "); return to false; }