javascript - 提交谷歌表单后如何重定向网站?

标签 javascript html forms google-apps-script google-forms

我在我的网站中使用Google表单,没有iframe标签,所以我没有找到如何写“谢谢”并取消转到Google表单的响应页面。

这是html代码:

<form action="https://docs.google.com/forms/u/2/d/e/1FAIpQLSeBJHw1Q6YlwO_0s2OgMhuyQEj4PLvToM1N1G5BEYQRiZlCLQ/formResponse">
                <label for="">It's FREE</label>
                <input type="text" placeholder="Full Name" class="inputs" id="input1" name="entry.1045366435">
                <input type="email" placeholder="Email" class="inputs" id="input2" name="entry.1398681060">
                <textarea id="" cols="30" rows="10" placeholder="Message" name="entry.403219718"></textarea>
                <input type="submit" id="submit" value="Send">
            </form>

<script type="text/javascript" src="form.js"></script>

js文件中需要写什么? 非常感谢!

最佳答案

您可以检查表单是否已提交。下面的代码使用了jQuery。

$('form').submit(function() {
  alert(1); // example code
  // add your code here
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form action="https://docs.google.com/forms/u/2/d/e/1FAIpQLSeBJHw1Q6YlwO_0s2OgMhuyQEj4PLvToM1N1G5BEYQRiZlCLQ/formResponse">
  <label for="">It's FREE</label>
  <input type="text" placeholder="Full Name" class="inputs" id="input1" name="entry.1045366435">
  <input type="email" placeholder="Email" class="inputs" id="input2" name="entry.1398681060">
  <textarea id="" cols="30" rows="10" placeholder="Message" name="entry.403219718"></textarea>
  <input type="submit" id="submit" value="Send">
</form>

关于javascript - 提交谷歌表单后如何重定向网站?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58882008/

相关文章:

带有 HTML 下拉菜单的 jQuery

jQuery hide() 不隐藏父级

javascript - 弹出图像和文本的 Dojo 对话框

php - 从 PHP 访问多个克隆字段

java - 将单选按钮绑定(bind)到 Spring Webflow 中的特定枚举值

javascript - Rethinkdb点changefeed不一致

javascript - 禁用onclick直到JS函数完成

javascript - 将图像悬停在图像上并在图像内显示文本

javascript - jquery如何获取post类型的ajax调用返回的状态消息?

javascript - 如何使用 JavaScript 放大一个点?