get 访问 在浏览器显示 json字符串
{"mobile":"1","mobileMsg":"手机未注册 请前去注册在充值!!","siteInfo":{想使用 $("#code").ajax({})的显示将上述内容以弹窗的形式体现 手机号在的情况下可以跳转第三方接口 但是手机号不存在的情况下 就弹不出提示窗口 换成$("#code").ajaxForm({})就可以以弹窗的形式显示 但是跳转不到第三方接口 浏览器显示CORS问题 如果解决使用 $("#code").ajax({})的弹窗显示 大佬们SOS。。。。。
$("#code").ajax({
dataType: "json"
, beforeSubmit: function(formData, jqForm, options) {
// 表单提交之前回调
// do nothing
}
, success: function(ret) {
console.log("ret:"+ret);
// 业务层验证成功
// 业务层验证失败
if (ret.mobileMsg) {
layer.msg(ret.mobileMsg, {
icon: 5
, shift: 6
, shade: 0.3
, time: 8500
, offset: "165px"
, closeBtn: 1
, shadeClose: true
}
);
}
}controller代码:
@Before(PayValidator.class)
public void toPay() throws IOException {
System.out.println("进入toPay的controller的方法!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
String price=getPara("price");
String type=getPara("type");
String pay_id=getPara("pay_id");
String param=getPara("param");
String mobile=getPara("mobile");
//异步通知地址
String notify_url="_view/pay/notify.jsp";
String return_url="";
if(price==null){
price="1";
}
Ret ret=payService.Exeic(mobile);
renderJson(ret);
//参数有中文则需要URL编码
String url="https://api.xiuxiu888.com/creat_order?id="&pay_id="+pay_id+"&price="+price+"&type="+type+"&token="+token+"¶m="+param+"¬ify_url="+notify_url+"&return_url="+return_url;
redirect(url);PayValidator校验代码
@Override
protected void validate(Controller c)
{
//获取校验电话号码
if (PayService.me.NameMobileExists(c.getPara("mobile"))) {
addError("mobileMsg", "手机未注册 请前去注册在充值!!");
}
项目:JFinal