Html Amp Post转到当前url?
<!doctype html>
<html ⚡>
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-form" rc="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>
</head>
<body>
<form class="-amp-form" method="post" target="_top" novalidate="" action-xhr="/Home/About">
<input name="name" class="data-input" required="" type="text" placeholder="Name...">
<input name="email" class="data-input" required="" type="email" placeholder="Email...">
<input class="button button-primary" type="submit" value="Subscribe">
</form>
</body>
</html>将鼠标悬停在浏览器中的提交输入按钮上会显示当前的url,而单击该按钮似乎什么也不做(使用httpFiddler时,不会发生post或get请求)。解决方案是一个标准的MVC5应用程序,将布局更改为在⚡声明和脚本中包含amp Html符号。你知道为什么当鼠标悬停在按钮上时会显示当前的url吗,比如https://localhost:44331/Home/Index,而当表单按钮被点击时却不会用上面的代码发布任何帖子?
这是我一直关注的资源之一:https://ampbyexample.com/components/amp-form/
发布于 2016-12-17 04:18:12
帖子正在工作,只是在帖子之后没有重定向到视图。浏览器使用表单上的'action‘属性来显示用户将被发送到的url,由于在amp action-xhr post中省略了此值,因此它只显示当前的url;然而,当单击它时,它仍然发送到正确的url。我想做的是一个帖子和重定向,目前似乎只有Get amp请求支持页面重定向。这在将来可能会改变,但目前它需要使用Get请求进行页面重定向。
https://stackoverflow.com/questions/41186140
复制相似问题