Last active
May 26, 2020 03:39
-
-
Save sosroInSpace/7960e26ab584f54d825b4ebb090c22c8 to your computer and use it in GitHub Desktop.
Generic Google Sheet Form Submission Function (jquery)
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
// 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