-
-
Save rememberlenny/9de4fdeb5c487ba020fb to your computer and use it in GitHub Desktop.
// 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 | |
} | |
} | |
}); |
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); |
Hi,
Could anyone explain to me what line 7 is about?
data: { "entry.1679407376": field1},
What is entry.1679407376?
Cheers
"entry.1679407376" is the key of the field provided by google form
If the google form have email filed then there is no entry ...what I have to pick in that case and what has to be passed into data{ }
@shamshul2007 Sorry I dont quite understand your issue. The data values can be found by looking at the google form using developer console and identifying the field's ID value.
@rememberlenny In case for the email field in the form. There is no entry field ID which I checked the view source.
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!
Hi,
Thank you for the code. I have tried with both the options but unable to save the form data into the google sheet. Though I get the success message (statusCode - 0) but response doesnt get recored into the sheet.
Is there anything which needs to be configured in a google form or response sheet to save data using AJAX request?
Thanks,