几年前,我在互联网上发现如何在联系页面中使用 Google 表单,仅使用属性提交按钮操作中的查询而不使用 iframe。现在,我再也找不到了。没有 iframe 是否仍然可以使用 Google 表单?
我刚刚找到了!
function postToGoogle() {
var field1 = $("input[type='radio'][name='qs1']:checked").val();
var field2 = $('#feed').val();
$.ajax({
url: "https://docs.google.com/forms/d/e/1FAIpQLSdjOTKRb7YiWi8OGPq6M6CRL0TpuAsUKacKp2XgruMbIp4wzg/formResponse",
data: {
"entry.924752166": field1,
"entry.997497831": field2
},
type: "POST",
dataType: "xml",
statusCode: {
0: function() {
//Success message
},
200: function() {
//Success Message
}
}
});
}
/*
$(document).ready(function() {
$('#form').submit(function() {
postToGoogle();
return false;
});
});
*/
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<strong>Test Google Form</strong>
<form id="form" target="_self" onsubmit="" action="javascript: postToGoogle()">
<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>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>
<br /><br />
The <a href="https://docs.google.com/spreadsheets/d/1bVeLfK2gm6emaGRKHnMllpeb_P4HwwZoIfZB5MCcyZg/pubhtml">Result</a> takes few minutes to be shown, but it is sent to the google sheet instantaneously.
<br /><br />
它正在工作于CodePen http://codepen.io/DonnyBrooker/pen/NbNNrw.
- 使用您自己的表单从您的网页将数据发送到 Google 文档
和阿贾克斯! https://wiki.base22.com/pages/viewpage.action?pageId=72942000
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)