function ajax(){ $.ajax( { type: "post", async: false,
//接口
url : "front/investor_info/save.jhtml", dataType: "json",
//保存在数据库中的对应名称,name是数据库的定义名称,_name是前端获取页面的值 data: { name: _name,sex:_sex,bornTime:_dbirth,nationality:_nationality,productName: _productName,price:_birth,timeType:_timeType,certificateType:_credentials,certificateNumber:_credentials_number,phoneNumber:_phone,email:_Email,signName: _name,uuid:_uuid}, beforeSend:function(){ // loadShow("加载中"); }, success : function(data){
//成功之后执行的地方 // location.href = 'RiskTolerance.html?name='+ escape(_name) +'&productName='+escape(_productName) + '&timeType=' + escape(_timeType) + '&uuid=' + _uuid; if(data.type=='success'){
//判断data.type后台返回的值是不是success,是就执行下面的内容,不是就执行else里面的内容 // layer.msg('提交成功'); location.href = 'RiskTolerance.html?name='+ escape(_name) +'&productName='+escape(_productName) + '&timeType=' + escape(_timeType) + '&uuid=' + _uuid; }else if(data.type == "error"){ layer.msg(data.content); }else{ layer.msg('提交失败'); } console.log(data); }, error : function(data) { //layer.msg('操作失败'); //调试 // location.href = '投资者风险承受能力问卷.html?name='+ escape(name) +'&productName='+escape(productName) + '&timeType=' + escape(timeType); // location.href = '投资者风险承受能力问卷.html?name='+ escape(name); //这句是放提交成功那行的。 } }); }