function checkFieldOct() { if($('#try-oct-name').val()=='' || $('#try-name').val()=='姓名'){ msg_trigger('msg-alert','請填寫您的姓名!!'); return false; } if($('#try-oct-phone').val()=='' || $('#try-oct-phone').val()=='手機號碼'){ msg_trigger('msg-alert','請填寫您的行動電話!!'); return false; } if (($('#try-oct-phone').val()!="") && (IsNumber($('#try-oct-phone').val())==false)) { msg_trigger('msg-alert','手機電話需全為數字!!(請勿以符號或全形數字輸入)'); return false; } if (($('#try-oct-phone').val()!="") && ($('#try-oct-phone').val().length != 10)) { msg_trigger('msg-alert','手機電話號碼有問題請檢查!! 謝謝!!(請勿以符號或全形數字輸入)'); return false; } if ($('#try-oct-phone').val().substring(2,0)!='09') { msg_trigger('msg-alert','請填寫正確的手機號碼!! 謝謝!!'); return false; } if ($('#try-oct-email').val()=="") { msg_trigger('msg-alert','請填寫email'); return false; } if ((!$('#try-oct-email').val() == "" && $('#try-oct-email').val().indexOf('@',0) == -1) || (!$('#try-oct-email').val() == "" && $('#try-oct-email').val().indexOf('.',0) == -1)) { msg_trigger('msg-alert',"請填寫正確的email。"); return false; } if(!ValidEmail($('#try-oct-email').val())) { msg_trigger('msg-alert',"請填寫正確的email!!"); return false; } if (!$('#try-oct-zone').val()) { msg_trigger('msg-alert',"請選擇地區!! 謝謝!!"); return false; } if (!$('#try-oct-store').val()) { msg_trigger('msg-alert',"請選擇櫃點!! 謝謝!!"); return false; } if(!$('#try-oct-agree').prop("checked")){ msg_trigger('msg-alert','您必須同意隱私權及網站使用條款始能參加本活動.'); return false; } //coupon_code = randomID(6); //console.log('229 coupon_code ='+coupon_code); //$('#randomID').text('E-'+coupon_code) //試用包,送出成功頁,隨機顯示的亂數 return true; } $().ready(function(){ //var coupon_code = ''; //$('#randomID').text('E-'+coupon_code) //試用包,送出成功頁,隨機顯示的亂數 //console.log('313 coupon_code = '+coupon_code); var json_callback_Oct = function(msg){ //alert(msg); if(window.console) console.log(msg); var json = [msg]; var s = msg.Statuss; if(s=='success') { // editor : min // name : Pixel - 全站再行銷 - 免費兌換成功 // date : 2022-12-29 // where : 埋在 head 之間 fbq('track', 'SubmitApplication'); msg_trigger('msg-try-success'); $('#try-oct-name').val(''); $('#try-oct-phone').val(''); $('#try-oct-email').val(''); //$('#try-date').val(''); //$('#try-time').val(''); wait_callback = ''; } else if(s=='already') { msg_trigger('msg-alert',"謝謝粉絲的熱烈支持! 您已經參加過本活動!"); clickga('重複填寫'); wait_callback = ''; } else { msg_trigger('msg-alert',s); wait_callback = ''; } } var wait_callback = ''; var agree_send = ''; var ad1 = ''; var ad2 = ''; var area = ''; var shop = ''; var user_date = ''; //msg_trigger('msg-alert','親愛的客戶您好,由於活動報名踴躍,為維護體驗品質,暫停接受報名,歡迎稍後再訪報名','感謝您的參與!'); if(window.console) console.log('actCode = '+actCode); if(gameover!='1'){ //send $('#try-oct-send').bind('click', function() { if(window.console) {console.log('確認送出 click');} //$('#randomID').text('E-'+coupon_code); //console.log('406 coupon_code = '+coupon_code); var a = checkFieldOct(); if(a){ if(wait_callback==''){ wait_callback = '1'; $.ajax({ url: 'reg_elemis.php', crossDomain: false, dataType: 'jsonp', contentType: "application/json", jsonpCallback: 'json_callback', data: { actCode: 'Campaign202410', uname: $('#try-oct-name').val(), phone: $('#try-oct-phone').val(), email: $('#try-oct-email').val(), //day_date: $('#try-date').val(), //day_time: $('#try-time').val(), store_area: $('#try-oct-zone').val(), store_name: $('#try-oct-store').val(), //coupon_code: $('#randomID').text(), //ig: $('#try-ig').val(), //vote: $('#try-game-result').val(), //recaptcha_response: $('#recaptcha_response').val(), //agree: $('input[name=agree]:checked').val(), form_id:'1',// 1.試用包 2.體驗 utm_campaign:utm_campaign, utm_medium:utm_medium, utm_term:utm_term, utm_source:utm_source, utm_content:utm_content, isMobileWeb:isMobileWeb }, success:json_callback_Oct //error: json_callback3 }).done(function(data){ //dddone(); }); } } }); } });