andy hace 3 años
padre
commit
1f8dce9e5c
Se han modificado 4 ficheros con 23 adiciones y 7 borrados
  1. BIN
      .DS_Store
  2. BIN
      img/.DS_Store
  3. 1 1
      index.html
  4. 22 6
      js/index.js

BIN
.DS_Store


BIN
img/.DS_Store


+ 1 - 1
index.html

@@ -734,7 +734,7 @@
               <img class="img-fluid" src="./img/collage.png" alt="">
               <img class="img-fluid" src="./img/collage.png" alt="">
             </div>
             </div>
             <div class="col-md-6">
             <div class="col-md-6">
-              <form class="violetbeauty_contract_form" action="/submitform" method="post">
+              <form class="violetbeauty_contract_form">
                 <p class="text-danger">提前預約時間為3天,若需安排近期時間請加入官方LINE</p>
                 <p class="text-danger">提前預約時間為3天,若需安排近期時間請加入官方LINE</p>
                 <input type="text" name="name" id="name" placeholder="請輸入姓名" required>
                 <input type="text" name="name" id="name" placeholder="請輸入姓名" required>
                 <input type="text" name="phone" id="phone" placeholder="請輸入電話">
                 <input type="text" name="phone" id="phone" placeholder="請輸入電話">

+ 22 - 6
js/index.js

@@ -413,7 +413,7 @@ var date = new Date();
 var year = date.getFullYear();
 var year = date.getFullYear();
 var month = ('0'+ (date.getMonth() + 1)).slice(-2);
 var month = ('0'+ (date.getMonth() + 1)).slice(-2);
 
 
-var day = ('0' + (date.getDate()+3)).slice(-2);
+var day = ('0' + (date.getDate())).slice(-2);
 // var day = date.getDay();
 // var day = date.getDay();
 console.log(date)
 console.log(date)
 console.log(date.getDate());
 console.log(date.getDate());
@@ -449,11 +449,27 @@ $(".violetbeauty_contract_form").submit(function (e) {
   var jsonString = JSON.stringify(jsonInfo);
   var jsonString = JSON.stringify(jsonInfo);
   console.log(jsonString),
   console.log(jsonString),
     $.ajax({
     $.ajax({
-      // type: 'POST',
-      // url: 'https://go.hhh.com.tw:8004/add_client_info',
-      // data: jsonString,
-      // dataType: 'json',
-
+      type: 'POST',
+      url: 'http://api.ptt.cx:18688/submitform',
+      data: jsonString,
+      dataType: 'json',
+      success: function (data) {
+        console.log('送出成功: ' + data);
+        alert("送出成功");
+        // if (data == 0) {
+        //   alert("送出成功");
+        // } else if (data == 1) {
+        //   alert("此email已填過表單");
+        // } else if (data == 2) {
+        //   alert("此phone已填過表單");
+        // } else if (data == 3) {
+        //   alert("此email、phone已填過表單");
+        // }
+        // location.reload();
+      },
     });
     });
   return false;
   return false;
+  
 });
 });
+
+