A quick solution to the problem will still be refreshed when submitting the Form page via Ajax, ajaxform

Source: Internet
Author: User

A quick solution to the problem will still be refreshed when submitting the Form page via Ajax, ajaxform

After half a day, I used to click the submit button and add fewertype="button"It turns out to be  <form >  <button id="sub" />   </form> The page will be refreshed when any result is obtained.

PS: There is a button in the form that will be automatically refreshed after ajax is submitted.

// Remember a pitfall (I am not very familiar with the front-end course, But I dug a pitfall for myself in the project, haha ...) <form class = "form-horizontal"> <div class = "form-group"> <label class = "col-sm-3 control-label"> modify data Name: </label> <div class = "col-sm-7"> <input type = "text" placeholder = "test22" class = "form-control"> </div> <div class = "col-sm-2"> <button class = "btn-primary" onclick = "resetCertificateName (14) "> modify </button> </div> </form>

When a button label exists in the form, the interface is refreshed after the form is submitted asynchronously using ajax. (It feels weird)

Cause: When a button exists, the form is submitted again, so the page is refreshed. (Previously thoughtbutton type='submit' ) Button.

Solution: Replace the button tag with the tag.. <A class = "btn-primary" onclick = "resetCertificateName (14)"> modify </a>

The above is a quick solution to the problem that will still be refreshed on the Ajax Form submission page introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave a message for me, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

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.