JSFiddle - React, Tailwind, and code Playground
by cambraca
HTML
<form id="theform">Email:
<input id="email" />
<input type="submit" value="Submit" />
</form>
JavaScript
$('#theform').submit(function (event) {
event.preventDefault();
var google_form_key = '1k1_sCSsOn5YpVRd8JX9WBOnVZc16psDy-zQ_YfeGCeA';
var data = {
"entry.1173392207": $('#email').val(),
"entry.289653705": window.location.toString()
};
$.post(
"https://docs.google.com/forms/d/" + google_form_key + "/formResponse",
data,
function () {
$('#email').val('success!');
},
function() {
$('#email').val('error!');
}
);
});