function Setpaypwd () {
var Mobile=document.getelementbyid ("Telphone"). Value;
var Paypassword=document.getelementbyid ("Paypwd"). Value;
var Repaypassword=document.getelementbyid ("Repaypwd"). Value;
Alert ("mobile=" +mobile+ "and" + "paypassword=" +paypassword);
if (Paypassword!=repaypassword) {
Alert ("Please reset the password before and after entering it!");
$ ("#payPwd"). focus ();
Return
}
Alert ("Password consistent, start interacting");
Front-back and back-desk interaction
$.ajax ({
Type: "POST",//Transmit by post
DataType: "JSON",//Data format: JSON
URL: ' ${path}/member/setpaypwd.shtml ',//Destination address
Data: {mobile:mobile, Paypassword:paypassword},
Error:function (XMLHttpRequest, Textstatus, Errorthrown) {},
Success:function (msg) {
if (Msg.ret!=1) {
Layer.msg (MSG.MSG);
}else{
Layer.msg (' Verify success, please set payment password! '), {
time:1000//2 seconds Off (default is 3 seconds if not configured)
}, function () {
Window.location.href= "${path}/goods/index.shtml";
});
}
}
});
Alert ("Setup succeeded! ");
}
The statement that triggers this method;
<input type= "button" onclick= "Setpaypwd ()" value= "Commit"/>
Background Receive code:
@RequestMapping ("/setpaypwd")
Public String setpaypwd (modelmap mm,string mobile,string paypwd) {
Jsonobject json = new Jsonobject ();
map<string, object> returnmap = new hashmap<string,object> ();
if (Stringutil.isblank (mobile) | | Stringutil.isblank (paypwd)) {
JSON = Getjson (0, NULL, "parameter missing!");
}
map<string,string> map = new hashmap<string,string> ();
Map.put ("Membermobile", mobile);
Map.put ("Memberpaypwd", paypwd);
Returnmap = Shopmemberservice.login (map);
if (returnmap!=null&& (String) returnmap.get ("Isresult"). Equals ("0")) {
Json.put ("ret", 1); 0 Failure 1 Successes
Json.put ("Data", Returnmap); Return data
Json.put ("MSG", "Set success!"); Return message
SetUser (RETURNMAP);
}else{
JSON = Getjson (0, NULL, (String) returnmap.get ("membermsg"));
}
Mm.put ("JSON", JSON);
return ajax_return;
}
Welcome to join the Web front-end interactive communication Group 04, a huge amount of learning materials free delivery
Front and rear interaction, use AJAX to transfer parameters, but not jump to the back of the path