The Ajax Submission Form form page will still refresh the J workaround

Source: Internet
Author: User
This article mainly introduces the AJAX Submission Form form page will still refresh the problem of a quick solution, and the form form in the presence of the button when the Ajax automatically refresh the problem, the need for friends can refer to, hope to help everyone.

For a long while, the original click submit button to add a type= "button" is <form > <button id= "sub"/> </form> results will refresh the page, plus just fine

Ps:form Auto Refresh after Ajax commit when button is present in form

In the record a pit (just learn the front desk, not very understand, the project himself to dig a hole, haha ... ) <form class= "Form-horizontal" ><p class= "Form-group" ><label class= "col-sm-3 Control-label" > Modified data name: </label><p class= "col-sm-7" > <input type= "text" placeholder= "test22" class= "Form-control" > </p><p class= "col-sm-2" ><button class= "btn btn-primary" onclick= "Resetcertificatename" > Modify </button></p></p></form>

When a button tag is present in a form, the form is asynchronously submitted with Ajax, and the face is refreshed. (It feels weird)

Cause: When the button is present, the form is submitted again, so the page is refreshed. (Previously thought that button type= ' submit ') button has the ability to submit the form.

FIX: The button label will be replaced with a label. <a class= "btn btn-primary" onclick= "Resetcertificatename" > Modify </a>

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.