The difference analysis of button buttons and submit in jquery Ajax _jquery

Source: Internet
Author: User
Copy Code code as follows:

<script type= "Text/javascript" >
$ (document). Ready (function () {
$ ("#submit"). Click (function () {
$.post ("sendpwd.php", {qqnum:$ ("#QQnum"). Val (), psw:$ ("#psw"). Val ()},function (data) {
$ ("#aaa"). HTML (data);
}, "html");
});
});
</script>

The JQuery Ajax Post method should have no problem writing, click submit Submit button, sendpwd.php through $_post receive the value, then echo a piece of data. However, it is always impossible to display the returned value. The reason is here:
Copy Code code as follows:

<input type= "Submit" name= "Submit" id= "Submission" value= "submitted"/>

The type of submit button is submit, no response after clicking. Because there is no intention to find a moment to click the results came out, and then changed back, and found that strange, the Internet, found that most of the button set to the type, and then changed to button, the problem solved.

What's the difference between button buttons and submit?
Submit is mainly submitted form, is a special button, the implementation of the submission action, button mainly with JavaScript operation, itself is a button, this is the fundamental difference. If you want to use submit, the validation requires return false. I think it is more convenient to set the button to operate.
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.