function GoogleForm() { //這裡要對應到自己的 javascript 名稱
//宣告欄位
var field1 = $("[name='請問參賽者姓名']").val();
var field2 = $("[name='請輸入參賽者身份證字號']").val();
$.ajax({
url: "https://docs.google.com/forms/u/0/d/e/1FAIpQLScUAOravR-3Ym7LlPnnIwdsD7C6iePNseZpRNv3VYBsSZPCSA/formResponse", //Google Form 裡面的 form action 網址 **記得要填**
data: { //Google Form 裡面的欄位 name **記得要改**
"entry.1188682743": field1,
"entry.1262208337": field2
},
type: "POST",
dataType: "xml",
statusCode: {
0: function() {
alert("已送出!"); //完成送出表單的警告視窗
window.location.assign("http://google.com"); //送出表單後的導向
},
200: function() {
alert("已送出!"); //完成送出表單的警告視窗
window.location.assign("http://google.com"); //送出表單後的導向
}
}
});
}
html.cafe - a realtime HTML editor and host
Edit the html in the top panel, see the result here.
Save your page and get a link to view it live, anywhere.