Last active
April 21, 2021 21:30
-
-
Save rememberlenny/9de4fdeb5c487ba020fb to your computer and use it in GitHub Desktop.
How to post to Google docs using a jQuery ajax POST request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// url is the link for the form view page | |
// data is the name attribute of the field | |
$.ajax({ | |
url: "https://docs.google.com/forms/d/1iqMixtVq4O0AFvYCZHbGerigi1G5Qb3XthXZX9VpNtk/formResponse", | |
data: { "entry.1679407376": field1}, | |
type: "POST", | |
dataType: "xml", | |
statusCode: { | |
0: function() { | |
//Success message | |
}, | |
200: function() { | |
//Success Message | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = new XMLHttpRequest(); | |
var d = new Date(); | |
var n = d.getTime(); | |
var url = 'https://docs.google.com/forms/d/1FhRXyqVohna2IdThVwONXLAAGW4f6Ioy46BR2MRZy68/formResponse'; | |
var data = { "entry.993789377": n}; | |
request.open('POST', url, true); | |
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); | |
request.send(data); |
Running into the same issue as @shamshul2007
When you explicitly "collect email addresses" then there is no "entry.x" id on the form. It looks like google form is using "emailAddress" as the name, although this doesn't work when I send emailAddress as the key.
Did you find out a solution @shamshul2007?
after creating form click three dots> go to get prefilled link>then inspect
you will get the input fields name
I'm surprised people still use this!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@rememberlenny In case for the email field in the form. There is no entry field ID which I checked the view source.