|
@@ -126,37 +126,77 @@ $(".contact-form1").submit(function (e) {
|
|
|
}
|
|
|
|
|
|
});
|
|
|
+ $(document).ready(function () {
|
|
|
+
|
|
|
+ //E-MAIL格式檢查
|
|
|
+
|
|
|
+ $("body").on("change", "#phone", function () {
|
|
|
+
|
|
|
+ $Phonechecking = IsPhone($("#phone").val());
|
|
|
+
|
|
|
+
|
|
|
+ if ($Phonechecking == false) {
|
|
|
+
|
|
|
+ alert("請填寫正確的手機格式");
|
|
|
+
|
|
|
+ // $("#email").blur(); //離開焦點
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+ function IsPhone(phone) {
|
|
|
+
|
|
|
+ var regex = /^[0-9]+$/;
|
|
|
+
|
|
|
+ if (!regex.test(phone)) {
|
|
|
+
|
|
|
+ return false;
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ return true;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
|
|
|
-$.ajax({
|
|
|
- type: 'POST',
|
|
|
- url: 'http://cal.ptt.cx/deco_request_detail',
|
|
|
- data: jsonString,
|
|
|
- dataType: 'json',
|
|
|
- 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已填過表單");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: 'http://cal.ptt.cx/deco_request_detail',
|
|
|
+ data: jsonString,
|
|
|
+ dataType: 'json',
|
|
|
+ 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已填過表單");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 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);
|
|
|
}
|
|
|
- },
|
|
|
- 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);
|
|
|
- }
|
|
|
-});
|
|
|
-return false;
|
|
|
+ });
|
|
|
+ return false;
|
|
|
});
|
|
|
|
|
|
|