$(".amend").click(function(){ var old_pass = $("#old_pass").val(); var new_pass = $("#new_pass").val(); var again_pass = $("#again_pass").val(); if(old_pass==""){ window.wxc.xcConfirm("请输入原密码", window.wxc.xcConfirm.typeEnum.info); return false; }else if(new_pass==""){ window.wxc.xcConfirm("请输入新密码", window.wxc.xcConfirm.typeEnum.info); return false; }else if(again_pass==""){ window.wxc.xcConfirm("请重新输入新密码", window.wxc.xcConfirm.typeEnum.info); return false; }else if(again_pass!=new_pass){ window.wxc.xcConfirm("两次密码输入不一致", window.wxc.xcConfirm.typeEnum.info); return false; } $.ajax({ url:'./zz-fx/control.php', //请求地址 type: "post", //请求方式 data:{ type:"distribut_ChangePassword", password:new_pass, passwordc:again_pass, password_old:old_pass }, async:false, dataType: "json", success: function (data) { console.log(data); if(data.code == 0){ setStorage("cutId",1); window.wxc.xcConfirm('密码修改成功,请重新登录!', window.wxc.xcConfirm.typeEnum.info,{ onOk:function(){ login_out(); } }); } }, fail: function (date) { // 此处放失败后执行的代码 } }); }) //设置字符串类型的本地缓存 function setStorage(objName, objValue){ var sto = window.localStorage; if (sto) sto.setItem(objName, objValue); }