|
@@ -104,11 +104,19 @@ function nft_sent_message() {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+// Email格式檢查
|
|
|
+function validate_email(email) {
|
|
|
+ const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
|
+ return re.test(String(email).toLowerCase());
|
|
|
+}
|
|
|
+
|
|
|
// 點擊「同意接收」按鈕
|
|
|
$(".nft-event").submit(function (e) {
|
|
|
alert('.nft-event submit'); // test
|
|
|
|
|
|
var email = $('#email').val();
|
|
|
+ var userid = $('#userid').val();
|
|
|
+ console.log('email = ' + email + ', userid = ' + userid); // test
|
|
|
|
|
|
// Email欄位必填檢查
|
|
|
if (email == "") { // 未輸入Email
|
|
@@ -116,15 +124,24 @@ $(".nft-event").submit(function (e) {
|
|
|
title: '注意!',
|
|
|
icon: 'error',
|
|
|
confirmButtonColor: '#3085d6',
|
|
|
- html: '請先輸入Email<p><p>我們會發送合約地址至您指定的Email',
|
|
|
+ html: '請先輸入Email<p><p>我們會發送合約地址至您指定的Email'
|
|
|
});
|
|
|
return false;
|
|
|
+ } else {
|
|
|
+ if (!validate_email(email)) {
|
|
|
+ Swal.fire({
|
|
|
+ title: 'Email格式錯誤',
|
|
|
+ icon: 'error',
|
|
|
+ confirmButtonColor: '#3085d6',
|
|
|
+ html: '請輸入正確的Email<p><p>我們會發送合約地址至您指定的Email'
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- var jsonInfo = $('.nft-event').serializeObject();
|
|
|
- console.log(jsonInfo);
|
|
|
+
|
|
|
+ var jsonInfo = {"email": email, "userid": userid};
|
|
|
var jsonString = JSON.stringify(jsonInfo);
|
|
|
- console.log(jsonString);
|
|
|
+ console.log(jsonString);
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'POST',
|