我想将表单回复发送给Google工作表,然后将用户重定向到感谢页面。 Google脚本将用户直接重定向到报告页面。我想放弃谷歌重定向并将我的地方。使用ajax重定向表单提交
形式:
<form method="post" id="formID" action="gscript">
...
</form>
脚本:
<script>
$(document).on('submit', '.formID', function(e) {
$.ajax({
url: $(this).attr('action'),
type: $(this).attr('method'),
data: $(this).serialize(),
success: function(html) {
alert('ok');
window.location("Thanks page link");
}
});
e.preventDefault();
});
</script>
不应该'.formID'是'#formID'? – manelgarcia
对,它应该x) – Kapparina
仍然无法正常工作。 :( – David