let oAudience; $(document).ready(function(){ oAudience = new Audience(); oAudience.init(); }); function Audience(){ this.init = function(){ if($('#frm_auth').length>0){ oAudience.initAuthUser(); } if($('#frm_regi').length>0){ oAudience.initRegiUser(); } } this.initAuthUser = function(){ let eleForm = $('#frm_auth'); let options = { url: '/_connector/yellow.501.php', data: {'viewID': "AUTH_USER"}, dataType: 'json', resetForm: false, type: 'post', // 'get' or 'post', override for form's 'method' attribute beforeSubmit: function () { // todo : validation if(!eleForm.find('#cellphone').val()){ alert('등록한 휴대폰 번호를 입력 하세요.'); eleForm.find('#cellphone').focus(); return(false); } return (true); }, success: function (jsonResult) { if(jsonResult.result){ document.location.reload(); }else { alert(jsonResult.error_msg) } } }; eleForm.ajaxForm(options); } this.initRegiUser = function(){ let eleForm = $('#frm_regi'); let options = { url: '/_connector/yellow.501.php', data: {'viewID': "REGI_USER"}, dataType: 'json', resetForm: false, type: 'post', // 'get' or 'post', override for form's 'method' attribute beforeSubmit: function () { // todo : validation let boolReturn = true; if(!$('#agree').prop('checked')){ alert('개인정보 수집/이용에 동의해주세요.'); return(boolReturn = false); }; $('.inp_box input,.inp_box select').each(function(){ if(!$.trim($(this).val())){ alert($(this).attr('placeholder')+'을(를) 입력해주세요.'); return(boolReturn = false); } }); return (boolReturn); }, success: function (jsonResult) { if(jsonResult.result){ $('#frm_regi')[0].reset(); alert('등록이 완료되었습니다.\n가입 승인후 온라인 심포지엄에\n참석이 가능하며 승인 절차는 24시간 이내로 처리됩니다.'); oCommon.toggleRegistration(); }else { alert(jsonResult.error_msg); } } }; eleForm.ajaxForm(options); } this.logout = function(strWebinarKey){ $.ajax({ url: '/_connector/yellow.501.php', data: {'viewID': 'LOGOUT', 'webinar_key': strWebinarKey}, type: 'POST', dataType: 'json', success: function (jsonResult) { if (jsonResult.result) { document.location.reload(); } } }); } }