JS代码:
$.ajax({
type: "get",
//async:false,
dataType:"jsonp",
url :verifyUrl,
data:"typeFlag=A&verifyCode=N¬eCode="+mobileCode,
jsonp:"callbackparam",
jsonpCallback:"ajaxTestFn",
success:
function(json){
if(json != null ){
if(json["Code"] == "0001"){
addCardInfoForm.submit();
}else if(json["Code"] == "0002"){
$("#errSendNo").text("验证码输入有误,请重新获取验证码!");
$("#errSendNo").removeClass("tips tips1").addClass("error");
$("#errSendNo").show();
$("#mobileCode").addClass("alert");
}
}
},
error:function(){
alert('fail');
}
});
function ajaxTestFn(json){
alert("32"+json);
}
java代码:
logs.info("_0001_短信校验成功");
JSONObject json = new JSONObject();
String callbackFunName = request.getParameter("callbackparam");
logs.info("--"+callbackFunName);
json.put("Code", "0001");
logs.info("==="+json.toString());
response.setCharacterEncoding("text/html;charset=UTF-8");
out.write(callbackFunName + "(" +json.toString()+")");
- Ajax跨域.zip (6.4 KB)
- 下载次数: 0