gpt4 book ai didi

javascript - 如何将数据从 html 表单发送到 google 电子表格

转载 作者:行者123 更新时间:2023-11-30 09:48:24 25 4
gpt4 key购买 nike

我有 Lname Fname 输入,我想将它的值发送到 google 电子表格。我怎么做?你能为新手提供一些简单的方法或教程吗?谷歌 API 开发人员指南太困惑了

最佳答案

<!DOCTYPE html>
<html>
<head>
<title>Test Google Forms</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
</head>
<body>
<div>
<div>
<strong>Test Google Form</strong>
</div>
<form id="form" target="_self" onsubmit="" action="">
<fieldset>
<label>Question 1</label>
<input id="qs1_op_1" type="radio" value="Yes" name="qs1">
<input id="qs1_op_2" type="radio" value="No" name="qs1">
</fieldset>
<fieldset>
<label>Question 2</label>
<input id="qs2_op_1" type="radio" value="Yes" name="qs2">
<input id="qs2_op_2" type="radio" value="No" name="qs2">
</fieldset>
<fieldset>
<label>Text</label>
<textarea id="feed" name="feed"></textarea>
</fieldset>
<div style="width: 100%; display: block; float: right;">
<button id="send" type="submit">
Send
</button>
</div>
</form>
</div>
<script type="text/javascript">
function postToGoogle() {
var field1 = $("input[type='radio'][name='qs1']:checked").val();
var field2 = $("input[type='radio'][name='qs2']:checked").val();
var field3 = $('#feed').val();

$.ajax({
url: "https://docs.google.com/forms/d/FORM_KEY/formResponse",
data: {"entry.1023121230": field3, "entry.1230072460": field1, "entry.2113237615": field2},
type: "POST",
dataType: "xml",
statusCode: {
0: function() {
//Success message
},
200: function() {
//Success Message
}
}
});
}

$(document).ready(function(){
$('#form').submit(function() {
postToGoogle();
return false;
});
});
</script>
</body>
</html>

有关更多详细信息,请查看这些链接 https://wiki.base22.com/pages/viewpage.action?pageId=72942000

http://quandaflow.com/

关于javascript - 如何将数据从 html 表单发送到 google 电子表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37742313/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com