我对放大器非常陌生。我无法理解amp电子邮件发件人如何看到用户响应数据。例如,如果有表单,发件人将如何收集安培邮件收件人在表单中输入的数据
<!doctype html>
<html ⚡4email>
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js"></script>
<style amp4email-boilerplate>body{visibility:hidden}</style>
<style amp-custom>
h1 {
margin: 1rem;
}
</style>
</head>
<body>
<form method="post"
action-xhr="https://example.com/subscribe" target="_top">
<fieldset>
<label>
<span>Email:</span>
<input type="email"
name="email"
required>
</label>
<br>
<input type="submit"
value="Subscribe">
</fieldset>
<div submit-success>
<template type="amp-mustache">
Subscription successful!
</template>
</div>
<div submit-error>
<template type="amp-mustache">
Subscription failed!
</template>
</div>
</form>
</body>
</html>
上面的代码由基本的AMP电子邮件组成,其格式允许用户使用其电子邮件进行订阅。当用户提交表单时,电子邮件ID将使用action-xhr
方法发送到form
标记的POST
属性中给定的URL。
如果操作成功,则显示submit-success
块。否则显示submit-error
块。该实现非常简单直接。您可以查看this link,以更好地理解这一点。