81,092
社区成员
发帖
与我相关
我的任务
分享
public String sendMsg() throws Exception {
System.out.println("++++++++++++++");
Msg msg = new Msg();
//获得随机6位代码
code =RandomStr.getRandomStr(6);
String str="您申请的短信验证码为:"+code+"请在页面中输入验证码完成验证";
//发送验证码
msg.sendMsg(phone, str);
return "sendMsg";
}
function valicheckcode(){
$("#number_msg").text("");
$("#number_msg_ok").text("");
if($("#txtVerifyCode").val() == ""){
$("#number_msg").text("别骗我了,验证码呢");
flag=false;
return false;
}else{
$.post(
"userAction.action!checkcode",
{VerifyCode:$("#txtVerifyCode").val()},
function(data){
if(data.ok){
$("#number_msg_ok").text("土豪金接收短信就是快");
flag=true;
}else{
$("#number_msg").text("错误验证码");
flag=false;
}
},
"json"
);
if(div){
return true;
}else{
return false;
}
}
<action name="userAction" class="com.pxj.action.UserAction">
<result name="checkcode" type="json"></result>
<result name="sendMsg" type="json"></result>
<td align="left"><input name="VerifyCode" id="txtVerifyCode" type="text" size="6" onblur="valicheckcode();">
<input name="get_verify" id="checkcode"
type="button" value="获取验证码" onclick="userAction!sendMsg">