Skip to content

Instantly share code, notes, and snippets.

@sosroInSpace
Last active May 26, 2020 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sosroInSpace/7960e26ab584f54d825b4ebb090c22c8 to your computer and use it in GitHub Desktop.
Save sosroInSpace/7960e26ab584f54d825b4ebb090c22c8 to your computer and use it in GitHub Desktop.
Generic Google Sheet Form Submission Function (jquery)
// google sheet form submission
function submit_sheet(submit_button,the_form,sheet,success_message,success_show){
// onclick of form submit button
jQuery(submit_button).click(function(e){
e.preventDefault();
// serialize form data
var form = jQuery(the_form).serialize();
alert(form);
// define google sheet form
var url = sheet;
$.ajax({
url: url,
type: "GET",
dataType:'json',
data: form,
success: function (event) {
// on success do stuff
jQuery(success_message).addClass(success_show);
}
});
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment