jquery Ajax Serialize Save data instance without refreshing

Source: Internet
Author: User

jquery Code

The code is as follows Copy Code

<script language= "javascript" >/* Rebate Process * *

$ (' #ajaxpassword '). Click (function () {
alert (' BB ');
Checkem ();
var postdata = $ (' #pwdmsg '). Serialize ();
alert (postdata);
$.ajax ({
Type: "POST",
URL: "update.php",
Data:postdata,
Success:function (msg) {
Alert (msg);
if (msg==1) {
Alert (' Password modification successful, please remember your new password! ');
location.href= ' http://www.111cn.net ';

}else{
Alert (msg);
}
}
});
})

</script>

Html

<!--Modify Password-->

The code is as follows Copy Code

<div id= "Passworddiv" >

<form id= "pwdmsg" name= "pwdmsg" >
<div class= "Aui_outer" >
<table class= "Aui_border" >
<tr>
&LT;TD class= "AUI_NW" ></td>
&LT;TD class= "Aui_n" ></td>
&LT;TD class= "Aui_ne" ></td>
</tr>
<tr>
&LT;TD class= "Aui_w" ></td>
&LT;TD class= "Aui_c" >
<div class= "Aui_inner" >
<div class= "Close_lay" ><a href= "Javascript:closela" (' Passworddiv '); " ></a></div>
<div class= "Aui_title" > Modify password </div>
<div class= "Aui_content" >
<table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" >
<tr>
&LT;TD class= "Td_1" > Old login Password:</td>
<td><input name= "Oldpwd" class= "text text_w2" type= "password" id= "Oldpwd" ></td>
</tr>
<tr>
&LT;TD class= "Td_1" > New login Password:</td>
<td><input name= "newpwd" type= "password" class= "text text_w2" id= "Newpwd" size= ">&nbsp;" Password length 6-12 character composition </td>
</tr>
<tr>
&LT;TD class= "Td_1" > Confirm New Password:</td>
<td><input name= "newpwd1" type= "password" class= "text text_w2" id= "Newpwd1" size= "></td>"
</tr>
</table>
</div>
<div class= "aui_jtqx" ><input type= "button" name= "" value= "Save Password" class= "aui_tjbtn" id= "Ajaxpassword"/>
<input name= "Action" type= "hidden" value= "6" >
</div>
</div></td>
&LT;TD class= "Aui_e" ></td>
</tr>
<tr>
&LT;TD class= "AUI_SW" ></td>
&LT;TD class= "aui_s" ></td>
&LT;TD class= "Aui_se" style= "cursor:se-resize;" ></td>
</tr>
</table>
</div>
</form>
</div>

update.php

This file is to use the Post method to accept AJAX data and then update, note: Ajax coding is uft8 if you are GBK page We do character encoding conversion can

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.