|
@@ -31,41 +31,200 @@ $(".banner-slider").slick({
|
|
|
});
|
|
|
|
|
|
|
|
|
-$.fn.serializeObject = function () {
|
|
|
- var o = {};
|
|
|
- var a = this.serializeArray();
|
|
|
- o["id"] = 0;
|
|
|
- o["time_stamp"] = "";
|
|
|
- $.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 || '';
|
|
|
- }
|
|
|
- });
|
|
|
+// $.fn.serializeObject = function () {
|
|
|
+// var o = {};
|
|
|
+// var a = this.serializeArray();
|
|
|
+// o["id"] = 0;
|
|
|
+// o["time_stamp"] = "";
|
|
|
+// $.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;
|
|
|
+// };
|
|
|
+
|
|
|
+// $(".contact-form1").submit(function (e) {
|
|
|
+// /* var formRef = $('#form1').serializeArray();
|
|
|
+// var jsonString = JSON.stringify(formRef);*/
|
|
|
+// var jsonInfo = $('.contact-form1').serializeObject();
|
|
|
+// var jsonString = JSON.stringify(jsonInfo);
|
|
|
+// console.log(jsonString);
|
|
|
+// if ($('#credit').prop("checked")) {
|
|
|
+// $.ajax({
|
|
|
+// type: 'POST',
|
|
|
+// url: 'https://api.ptt.cx:9999/hhh/mail/deco/v2',
|
|
|
+// data: jsonString,
|
|
|
+// dataType: 'json',
|
|
|
+// contentType: 'application/json; charset=utf-8',
|
|
|
+
|
|
|
|
|
|
- return o;
|
|
|
-};
|
|
|
+// success: function (res) {
|
|
|
+// alert('送出成功');
|
|
|
+// },
|
|
|
+// error: function (error) {
|
|
|
+// console.error(error);
|
|
|
+// alert('送出失敗');
|
|
|
+// }
|
|
|
+
|
|
|
+// });
|
|
|
+// $.ajax({
|
|
|
+// type: 'POST',
|
|
|
+// url: 'https://go.hhh.com.tw:8002/deco_request_detail',
|
|
|
+// data: jsonString,
|
|
|
+// dataType: 'json',
|
|
|
+// // async: false,
|
|
|
+// success: function (data) {
|
|
|
+// console.log('送出成功: ' + data);
|
|
|
+// if (data == 0) {
|
|
|
+// alert("送出成功");
|
|
|
+// } else if (data == 1) {
|
|
|
+// alert("此email已填過表單");
|
|
|
+// } else if (data == 2) {
|
|
|
+// alert("此phone已填過表單");
|
|
|
+// } else if (data == 3) {
|
|
|
+// alert("此email、phone已填過表單");
|
|
|
+// }
|
|
|
+// location.href ="./index_complete_line.html";
|
|
|
+
|
|
|
+// },
|
|
|
+// beforeSend: function () {
|
|
|
+// console.log('beforeSend');
|
|
|
+// },
|
|
|
+// complete: function () {
|
|
|
+// console.log('complete');
|
|
|
+// },
|
|
|
+// error: function (jqXHR, textStatus, errorThrown) {
|
|
|
+// console.log(JSON.stringify(jqXHR));
|
|
|
+// console.log("AJAX errr: " + textStatus + ' : ' + errorThrown);
|
|
|
+// console.log('送出失敗: ' + jqXHR.responseText);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
+// else{
|
|
|
+// $.ajax({
|
|
|
+// type: 'POST',
|
|
|
+// url: 'https://go.hhh.com.tw:8002/deco_request_detail',
|
|
|
+// data: jsonString,
|
|
|
+// dataType: 'json',
|
|
|
+// // async: false,
|
|
|
+// success: function (data) {
|
|
|
+// console.log('送出成功: ' + data);
|
|
|
+// if (data == 0) {
|
|
|
+// alert("送出成功");
|
|
|
+// } else if (data == 1) {
|
|
|
+// alert("此email已填過表單");
|
|
|
+// } else if (data == 2) {
|
|
|
+// alert("此phone已填過表單");
|
|
|
+// } else if (data == 3) {
|
|
|
+// alert("此email、phone已填過表單");
|
|
|
+// }
|
|
|
+// location.href ="./index_complete_line.html";
|
|
|
+
|
|
|
+// },
|
|
|
+// beforeSend: function () {
|
|
|
+// console.log('beforeSend');
|
|
|
+// },
|
|
|
+// complete: function () {
|
|
|
+// console.log('complete');
|
|
|
+// },
|
|
|
+// error: function (jqXHR, textStatus, errorThrown) {
|
|
|
+// console.log(JSON.stringify(jqXHR));
|
|
|
+// console.log("AJAX errr: " + textStatus + ' : ' + errorThrown);
|
|
|
+// console.log('送出失敗: ' + jqXHR.responseText);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
+// // if ($('#credit').prop("checked")) {
|
|
|
+// // $.ajax({
|
|
|
+// // type: 'POST',
|
|
|
+// // url: 'https://api.ptt.cx:9999/hhh/mail/deco/v2',
|
|
|
+// // data: jsonString,
|
|
|
+// // dataType: 'json',
|
|
|
+// // contentType: 'application/json; charset=utf-8',
|
|
|
+
|
|
|
+
|
|
|
+// // success: function (res) {
|
|
|
+// // alert('送出成功');
|
|
|
+// // },
|
|
|
+// // error: function (error) {
|
|
|
+// // console.error(error);
|
|
|
+// // alert('送出失敗');
|
|
|
+// // }
|
|
|
+
|
|
|
+// // });
|
|
|
+// // }
|
|
|
+// return false;
|
|
|
+// });
|
|
|
+
|
|
|
+function submit() {
|
|
|
+ $('#submitbutton').text('表單送出中,請稍後');
|
|
|
+
|
|
|
+ let loc = $( "#loc option:selected" ).text();
|
|
|
+
|
|
|
+ let h_class=$( "#h_class option:selected" ).text();
|
|
|
+
|
|
|
+ let size=$( "#size option:selected" ).text();
|
|
|
+
|
|
|
+ let name=$( "#name" ).val();
|
|
|
+
|
|
|
+ let email=$( "#email" ).val();
|
|
|
+
|
|
|
+ let phone=$( "#phone" ).val();
|
|
|
+
|
|
|
+ let version=$( "#version" ).val();
|
|
|
|
|
|
-$(".contact-form1").submit(function (e) {
|
|
|
- /* var formRef = $('#form1').serializeArray();
|
|
|
- var jsonString = JSON.stringify(formRef);*/
|
|
|
- var jsonInfo = $('.contact-form1').serializeObject();
|
|
|
- var jsonString = JSON.stringify(jsonInfo);
|
|
|
- console.log(jsonString);
|
|
|
+
|
|
|
+ let formdata='';
|
|
|
+
|
|
|
+ formdata='{"email": "' + email + '",'
|
|
|
+ formdata+='"name": "' + name + '",'
|
|
|
+ formdata+='"phone": "' + phone + '",'
|
|
|
+ formdata+='"loc": "' + loc + '",'
|
|
|
+ formdata+='"h_class": "' + h_class + '",'
|
|
|
+ formdata+='"version": "' + version + '",'
|
|
|
+ formdata+='"id": "' + 0 + '",'
|
|
|
+ formdata+='"time_stamp": "' + 0 + '",'
|
|
|
+ formdata+='"size": "' + size + '"}';
|
|
|
+
|
|
|
+console.log(formdata);
|
|
|
+
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: 'https://go.hhh.com.tw:8002/deco_request_detail',
|
|
|
- data: jsonString,
|
|
|
+ data: formdata,
|
|
|
dataType: 'json',
|
|
|
// async: false,
|
|
|
+
|
|
|
success: function (data) {
|
|
|
console.log('送出成功: ' + data);
|
|
|
if (data == 0) {
|
|
|
- alert("送出成功");
|
|
|
+ if ($('#credit').prop("checked")) {
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: 'https://api.ptt.cx:9999/hhh/mail/deco/v2',
|
|
|
+ data: formdata,
|
|
|
+ dataType: 'json',
|
|
|
+ contentType: 'application/json; charset=utf-8',
|
|
|
+ async: false,
|
|
|
+
|
|
|
+ success: function (res) {
|
|
|
+ console.log('送出成功');
|
|
|
+ },
|
|
|
+ error: function (error) {
|
|
|
+ console.error(error);
|
|
|
+ console.log('送出失敗');
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // alert("送出成功");
|
|
|
} else if (data == 1) {
|
|
|
alert("此email已填過表單");
|
|
|
} else if (data == 2) {
|
|
@@ -73,43 +232,29 @@ $(".contact-form1").submit(function (e) {
|
|
|
} else if (data == 3) {
|
|
|
alert("此email、phone已填過表單");
|
|
|
}
|
|
|
- location.href ="./index_complete_line.html";
|
|
|
-
|
|
|
+ location.href = "./index_complete_line.html";
|
|
|
},
|
|
|
+
|
|
|
beforeSend: function () {
|
|
|
console.log('beforeSend');
|
|
|
},
|
|
|
complete: function () {
|
|
|
console.log('complete');
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
+
|
|
|
error: function (jqXHR, textStatus, errorThrown) {
|
|
|
console.log(JSON.stringify(jqXHR));
|
|
|
console.log("AJAX errr: " + textStatus + ' : ' + errorThrown);
|
|
|
console.log('送出失敗: ' + jqXHR.responseText);
|
|
|
+ alert("送出失敗");
|
|
|
}
|
|
|
});
|
|
|
- if ($('#credit').prop("checked")) {
|
|
|
- $.ajax({
|
|
|
- type: 'POST',
|
|
|
- url: 'https://api.ptt.cx:9999/hhh/mail/deco/v2',
|
|
|
- data: jsonString,
|
|
|
- dataType: 'json',
|
|
|
- contentType: 'application/json; charset=utf-8',
|
|
|
-
|
|
|
|
|
|
- success: function (res) {
|
|
|
- alert('送出成功');
|
|
|
- },
|
|
|
- error: function (error) {
|
|
|
- console.error(error);
|
|
|
- alert('送出失敗');
|
|
|
- }
|
|
|
|
|
|
- });
|
|
|
- }
|
|
|
return false;
|
|
|
-});
|
|
|
-
|
|
|
+}
|
|
|
|
|
|
$("*").each(function (index, element) {
|
|
|
// 此元素被點選後執行
|