Email

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
min-height: 100vh;
background-image: url('https://cdn.shoplazza.com/9c235166719b5cebc1f2e0219f2bfe82.png'); /* 桌面端图片 */
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
}

.subscription-form {
max-width: 400px;
margin: 50px auto;
padding: 20px;
background-color: rgba(255, 255, 255, 0.8);
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
text-align: center;
}

.subscription-form input[type="email"] {
width: 80%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}

.subscription-form button {
padding: 10px 20px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}

.subscription-form button:hover {
background-color: #45a049;
}

/* 手机端样式 */
@media (max-width: 600px) {
body {
background-image: url('https://cdn.shoplazza.com/9c235166719b5cebc1f2e0219f2bfe82.png'); /* 手机端图片 */
background-size: cover;
}

.subscription-form {
width: 90%;
padding: 15px;
}

.subscription-form input[type="email"] {
width: 100%;
}
}
</style>
</head>
<body>

<div class="subscription-form">
<h2>Subscribe to Our Newsletter</h2>
<form id="emailForm">
<input type="email" id="email" placeholder="Enter your email address" required>
<button type="submit">Subscribe</button>
</form>
</div>

<script>
document.getElementById('emailForm').addEventListener('submit', function(event) {
event.preventDefault(); // 阻止默认表单提交

const email = document.getElementById('email').value;

// 发送请求到你的后端或直接调用 Shoplazza API
fetch('YOUR_API_ENDPOINT', { // 替换为实际的 API 端点
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN' // 如果需要认证
},
body: JSON.stringify({ email: email })
})
.then(response => response.json())
.then(data => {
console.log('Success:', data);
alert('Thank you for subscribing!');
})
.catch((error) => {
console.error('Error:', error);
alert('There was an error, please try again.');
});
});
</script>

</body>
</html>