Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iamsunny/edd3fed7b6495c4a0f4319efb25f6e40 to your computer and use it in GitHub Desktop.
Save iamsunny/edd3fed7b6495c4a0f4319efb25f6e40 to your computer and use it in GitHub Desktop.
post to google sheets from html form using ajax
function subscribe() {
var email = $("#emailId").val();
$.ajax({
url: "https://docs.google.com/forms/d/e/1FAIpQLSc8TP0eS1iPwap4dVM6IlEWtkw_kHfpmDedlLWc5lQ88_2xCw/formResponse?",
data: { "entry.1709137143": email}, // replace the numeric part of "entry.______" with the actual field name. more fields can be added in the data object
type: "POST",
success: function(d) {alert("thank you, you're subscribed to ngIndia 2020 updates")},
error: function(d) {alert("oops! something went wrong, please try again.")}
});
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment