<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

?>
<!-- contact area start -->
<section id="menu<?php echo $j;?>" class="ok-contact-section">
  <div class="container">
    <div class="row">
      <div class="col-12 text-center">
        <div class="ok-section-title">
            <h2 class="section-title">고객센터</h2>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-md-6">
        <form id="contact-input" method="" action="" novalidate="novalidate">
          <div class="form-group">
            <label for="contact_name" class="control-label">성명</label>
              <input type="text" id="contact_name" class="form-control" name="contact_name" placeholder="성명*" required="required">
          </div>
          <div class="form-group">
            <label for="email_address" class="control-label">Email</label>
              <input class="form-control" type="email" id="email_address" name="email_address" placeholder="Email*"
              required="required">
            </div>
            <div class="form-group">
              <label for="phone_number" class="control-label">전화번호</label>
              <input class="form-control" type="text" id="phone_number" name="phone_number" placeholder="전화번호">
            </div>
            <div class="form-group">
              <label for="contact_type" class="control-label">문의종류</label>
              <select  class="form-control"
              id="contact_type" name="contact_type">
                <option value="제품문의">제품문의</option>
                <option value="제휴문의">제휴문의</option>
                <option value="기술문의">기술문의</option>
                <option value="기타">기타</option>
              </select>
            </div>
            <div class="form-group">
              <label for="me_content" class="control-label">문의내용</label>
              <textarea id="me_content" class="form-control" name="me_content" placeholder="내용 ..."></textarea>
            </div>
            <button type="button" class="btn btn-success btn-block" name="insert-data" id="insert-data">보내기</button>
            <p id="message" class="result_message"></p>
        </form>
      </div>
      <div class="col-md-6 mapWrapper">
        <?php echo $okone_bn['okone_map'];?>
      </div>
    </div>
  </div>
</section>


<script type="text/javascript">

$(document).ready(function(){
  $("#insert-data").click(function(){
    var me_name=$("#contact_name").val();
    var me_email=$("#email_address").val();
    var me_tel=$("#phone_number").val();
    var me_type=$("#contact_type").val();
    var me_content=$("#me_content").val();

// AJAX code to send data to php file.
        $.ajax({
            method: "POST",
            url: "<?php echo G5_THEME_URL;?>/contact_insert.php",
            data: {
              me_name:me_name,
              me_email:me_email,
              me_tel:me_tel,
              me_type:me_type,
              me_content:me_content
            },
            success: function(data) {
             $("#message").html(data);
            $(".result_message").addClass("alert alert-success");
            $("#contact-input")[0].reset();
            },
            error: function(err) {
            alert(err);
            $("#contact-input")[0].reset();
            }
        });
      });
    });

  </script>
