jquery代碼
代碼如下 |
複製代碼 |
<script language="javascript">/*返利流程*/ $('#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('密碼修改成功,請牢記您新密碼!'); location.href='http://www.111cn.net'; }else{ alert(msg); } } }); }) </script> html |
<!-- 修改密碼 -->
代碼如下 |
複製代碼 |
<div id="passworddiv"> <form id="pwdmsg" name="pwdmsg"> <div class="aui_outer"> <table class="aui_border"> <tr> <td class="aui_nw"></td> <td class="aui_n"></td> <td class="aui_ne"></td> </tr> <tr> <td class="aui_w"></td> <td class="aui_c"> <div class="aui_inner"> <div class="close_lay"><a href="javascript:closela('passworddiv');"></a></div> <div class="aui_title">修改密碼</div> <div class="aui_content"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="td_1">舊登入密碼:</td> <td><input name="oldpwd" class="text text_w2" type="password" id="oldpwd" ></td> </tr> <tr> <td class="td_1">新登入密碼:</td> <td><input name="newpwd" type="password" class="text text_w2" id="newpwd" size="30" > 密碼長度6-12字元組成</td> </tr> <tr> <td class="td_1">確認新密碼:</td> <td><input name="newpwd1" type="password" class="text text_w2" id="newpwd1" size="30"></td> </tr> </table> </div> <div class="aui_jtqx"><input type="button" name="" value="儲存密碼" class="aui_tjbtn" id="ajaxpassword" /> <input name="action" type="hidden" value="6"> </div> </div></td> <td class="aui_e"></td> </tr> <tr> <td class="aui_sw"></td> <td class="aui_s"></td> <td class="aui_se" style="cursor: se-resize;"></td> </tr> </table> </div> </form> </div> |
update.php
這個檔案就是利用post方式接受ajax過來的資料然後進行更新了,注意:ajax編碼是uft8的如果你是gbk頁面我們進行字元編碼轉換即可