JavaScript in the AJAX submission Process page display loading, please wait for the effect, and in the submission process to limit the determination of the button to prevent multiple submissions, after the completion of the submission, the release limit

Source: Internet
Author: User

In the load, wait for the DIV:

<div id= "Load" class= "Center-in-center" style= "Display:none;" >      Loading, please wait for ...</div>
To determine the reset button:
<Divclass= "Form-group row">  <Divclass= "conf"style= "Float:left"onclick= "conf ()"ID= "conf">Are you sure</Div>  <Divclass= "Reset"style= "Float:left"onclick= "Reset ()"ID= "Reset">Reset</Div></Div>
Load, please wait for the CSS style, set it to the center of the page:
. center-inch-center{Position:absolute; Top: -%; Left: -%; -webkit-transform:translate (- -%, - -%); -moz-transform:translate (- -%, - -%); -ms-transform:translate (- -%, - -%); -o-transform:translate (- -%, - -%); Transform:translate (- -%, - -%); }

Ajax Commit Code:

$.ajax ({type: ' POST '), URL:"", data: {},//JSON dataBeforesend:function(XMLHttpRequest) {$ ("#load"). Show (); $("#conf"). Removeattr ("onclick");//During the commit process, make sure the button is set to not clickable (Method 1)//$ (' #conf '). attr (' onclick ', ' javascript:void (0); '); /Set the button to not clickable (Method 2)}, Success:function(resultmessage) {$ ("#load"). Hide (); varResultmessage = eval (' (' + resultmessage + ') ');                          alert (Resultmessage.result); if(resultmessage.result) {alert (resultmessage.message); $("#conf"). attr ("onclick", "conf ();");//submit successful, set button to clickable}Else{alert (resultmessage.message); $("#conf"). attr ("onclick", "conf ();"); }                            },//datatype:datatype});
In the load, wait for the action to be: $ ("#load") in Beforesend. Show () shows the picture in success $ ("#load"). Hide () hides the image to
Button Commit restriction action: Set the button in Beforesend, respectively, and then set the button again in success to submit it after the submission is successful.


JavaScript in the AJAX submission Process page display loading, please wait for the effect, and in the submission process to limit the determination of the button to prevent multiple submissions, after the completion of the submission, the release limit

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.