$(document).ready(function() { $("#btnSubmit").click(function(){ if(submit_check() == true){ $("#btnSubmit").hide(); var param = "inquiryname="+ encodeURIComponent(dvf_ISNULL($("#inquiryname").val(), "")); param += "&inquiryid="+ encodeURIComponent(dvf_ISNULL($("#inquiryid").val(), "")); param += "&inquiryEmail="+ encodeURIComponent(dvf_ISNULL($("#inquiryEmail").val(), "")); param += "&inquiryPhone="+ encodeURIComponent(dvf_ISNULL($("#inquiryPhone").val(), "")); param += "&inquiryTitle="+ encodeURIComponent(dvf_ISNULL($("#inquiryTitle").val(), "")); param += "&inquirycontents="+ encodeURIComponent(dvf_ISNULL($("#inquirycontents").val(), "")); $.ajax({ url: '/service/user_support/svc_cust_inquiry_write_ok.asp', type: 'POST', data: param, dataType: 'json', //timeout: 3000, error: function(p_req, p_status, p_err) { alert("["+ p_status + "]"+"불편문의 등록이 실패되었습니다."); $("#btnSubmit").show(); }, success: function(p_data) { alert('고객님의 글이 고객지원센터에 등록되었습니다.\n 메인화면으로 이동합니다.'); document.location.href='/'; } }); } }); }); function isEmail(s){ return s.search(/^\s*[\w\~\-\.]+\@[\w\~\-]+(\.[\w\~\-]+)+\s*$/g)>=0; } function submit_check(){ if(dvf_ISNULL($("#inquiryname").val(), "") == "" ){ alert("이름을 입력해 주세요."); $("#inquiryname").focus(); return false; } if(dvf_ISNULL($("#inquiryEmail").val(), "") == "" ){ alert("이메일을 입력해 주세요."); $("#inquiryEmail").focus(); return false; } if (!isEmail(dvf_ISNULL($("#inquiryEmail").val(), ""))){ alert("정확한 이메일을 입력해 주세요."); $("#inquiryEmail").val(""); $("#inquiryEmail").focus(); return false; } if(dvf_ISNULL($("#inquiryPhone").val(), "") == "" ){ alert("연락처를 입력해 주세요."); $("#inquiryPhone").focus(); return false; } if(dvf_ISNULL($("#inquiryTitle").val(), "") == "" ){ alert("제목을 입력해 주세요."); $("#inquiryTitle").focus(); return false; } if(dvf_ISNULL($("#inquirycontents").val(), "") == "" ){ alert("내용을 입력해 주세요."); $("#inquirycontents").focus(); return false; } if (document.getElementById("agreen").checked){ alert('불편신고 작성을 위한 개인정보 수집동의를 하셔야 글 작성이 가능합니다.'); document.getElementById("agreey").focus(); return false; } return true; }