Copy codeThe Code is 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>
There should be no problem in writing the post method of jQuery ajax in this way. Click the submit button, sendPwd. php receives the passed value through $ _ POST, and then echo a piece of data. However, the returned values cannot be displayed. The reason is as follows:Copy codeThe Code is as follows: <input type = "submit" name = "submit" id = "submit" value = "submit"/>
The type of the submit button is submit. After clicking the button, there is no response. Because I accidentally found that the results were returned when I clicked the button, I found it strange. I checked it online and found that most of the buttons were set to the button type, so I changed it to the button type, the problem is solved.
What is the difference between button and submit?
The submit mainly refers to the submission form. It is a special button that executes the submission action. The button mainly works with javascript operations and is itself a button. This is the fundamental difference. If you want to use submit, return false is required for verification. I think it is more convenient to set a button.