Last active
December 27, 2015 20:09
-
-
Save ericpgreen/7381886 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Test Google Forms</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> | |
</head> | |
<body> | |
<div> | |
<div> | |
<strong>Test Google Form</strong> | |
</div> | |
<form id="form" target="_self" onsubmit="" action=""> | |
<fieldset> | |
<label for="email">What's your email? *</label> | |
<input id="email" type="text" name="email"> | |
</fieldset> | |
<div style="width: 100%; display: block; float: right;"> | |
<button id="send" type="submit"> | |
Send | |
</button> | |
</div> | |
</form> | |
</div> | |
<script type="text/javascript"> | |
function postToGoogle() { | |
var email = $('#email').val(); | |
$.ajax({ | |
url: "https://docs.google.com/forms/d/formid-here/formResponse", | |
data: {"entry.222120245": email}, | |
type: "POST", | |
dataType: "xml", | |
statusCode: { | |
0: function() { | |
//Success message | |
}, | |
200: function() { | |
//Success Message | |
} | |
} | |
}); | |
} | |
$(document).ready(function(){ | |
$('#form').submit(function() { | |
postToGoogle(); | |
return false; | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment