Skip to content

Instantly share code, notes, and snippets.

@karimmakhloufi
Last active November 7, 2019 04:18
Show Gist options
  • Save karimmakhloufi/ee2d15c613eefd150e21daaaa23aac8a to your computer and use it in GitHub Desktop.
Save karimmakhloufi/ee2d15c613eefd150e21daaaa23aac8a to your computer and use it in GitHub Desktop.
<form id="leadForm" action="https://script.google.com/macros/s/AKfycbyd9b-t6PKBKZPrtKTNhG9fNUWHmPGjVg4VnhWIrKundTFlZLI/exec">
<input type="email" name="email" placeholder="Your email address">
<input type="submit" id="LeadFormSubmit">
</form>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var $form = $('#leadForm');
var $subm = $('#LeadFormSubmit');
var $impt = $form.find(':input').not(':button, :submit, :reset, :hidden');
$form.submit(function(){
$.post($(this).attr('action'), $(this).serialize(), function(response){
$impt.val('').attr('value','').removeAttr('checked').removeAttr('selected');
$subm.prop('disabled', true);
},'json');
return false;
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment