function checkData(){ if($("input[name='regionName']").val()==""){ layer.msg("所属地区不能为空", {icon: 2,time:2000}); return false; } if($("input[name='phone']").val()==""){ layer.msg("联系电话不能为空", {icon: 2,time:2000}); return false; }/* else{ var checkMobile = /^1[345789]d{9}$/; if(!checkMobile.test($("#phone").val())){ layer.msg("请正确填写手机号", {icon: 2,time:2000}); return false; } } */ return true; } //提交 function save(){ if(!checkData()){ return false; } var formData = new FormData($("#inputForm")[0]); var loadIndex; $.ajax({ type : 'POST', processData : false, contentType : false, url : '${ctx}/cand/candidate/save', data : formData, dataType: "json", beforeSend : function() { loadIndex=showLoad('正在提交,请稍等...'); }, complete: function () { layer.close(loadIndex); }, success : function(data) { if(data.success==true){ location = "${ctx}/cand/candidate/list?type=${candidate.type}"; layer.msg(data.msg, {icon: 1,time:2000}); }else{ layer.msg(data.msg, {icon: 2,time:2000}); } layer.close(loadIndex); }, error:function(){ layer.msg("请求失败", {icon: 2,time:2000}); layer.close(loadIndex); } }, 'json'); }