Browse Source

html js update

andy 3 years ago
parent
commit
f30e1b7a6d
4 changed files with 39 additions and 4 deletions
  1. BIN
      .DS_Store
  2. BIN
      img/.DS_Store
  3. 4 4
      index.html
  4. 35 0
      js/index.js

BIN
.DS_Store


BIN
img/.DS_Store


+ 4 - 4
index.html

@@ -734,7 +734,7 @@
               <img class="img-fluid" src="./img/collage.png" alt="">
             </div>
             <div class="col-md-6">
-              <div class="violetbeauty_contract_form">
+              <form class="violetbeauty_contract_form" action="/submitform" method="post">
                 <p class="text-danger">提前預約時間為3天,若需安排近期時間請加入官方LINE</p>
                 <input type="text" name="name" id="name" placeholder="請輸入姓名" required>
                 <input type="text" name="phone" id="phone" placeholder="請輸入電話">
@@ -756,12 +756,12 @@
                   <option value="淨透無暇美背 /80分">淨透無暇美背 /80分</option>
                   <option value="五行水晶能量岩盤浴 /40分">五行水晶能量岩盤浴 /40分</option>
                 </select>
-                <input name="prefer_date" class="datepicker" type="date" id="datepicker" placeholder="預選裝修日期" required>
-                <input name="prefer_date" class="time" type="time" id="time" placeholder="想要體驗的時間" required>
+                <input name="date" class="datepicker" type="date" id="datepicker" placeholder="預選裝修日期" required>
+                <input name="time" class="time" type="time" id="time" placeholder="想要體驗的時間" required min="10:30" max="18:30">
                 <div class="form-btn">
                   <button class="btn submitbutton" style="opacity: 1;" type="submit">立即預約&nbsp;&nbsp;></button>
                 </div>
-              </div>
+              </form>
             </div>
 
           </div>

+ 35 - 0
js/index.js

@@ -409,3 +409,38 @@ $.ajax({
     console.log('err', err);
   }
 });
+
+// 手機板表單
+$.fn.serializeObject = function () {
+  var o = {};
+  var a = this.serializeArray();
+
+  $.each(a, function () {
+    if (o[this.name]) {
+      if (!o[this.name].push) {
+        o[this.name] = [o[this.name]];
+      }
+      o[this.name].push(this.value || '');
+    } else {
+      o[this.name] = this.value || '';
+    }
+  });
+
+  return o;
+};
+
+$(".violetbeauty_contract_form").submit(function (e) {
+  /*	var formRef = $('#form1').serializeArray();
+    var jsonString = JSON.stringify(formRef);*/
+  var jsonInfo = $('.violetbeauty_contract_form').serializeObject();
+  var jsonString = JSON.stringify(jsonInfo);
+  console.log(jsonString),
+    $.ajax({
+      // type: 'POST',
+      // url: 'https://go.hhh.com.tw:8004/add_client_info',
+      // data: jsonString,
+      // dataType: 'json',
+
+    });
+  return false;
+});