Skip to content

Instantly share code, notes, and snippets.

@jermspeaks
Created July 7, 2015 23:26
Show Gist options
  • Save jermspeaks/707c0e5a5e94225a0d9d to your computer and use it in GitHub Desktop.
Save jermspeaks/707c0e5a5e94225a0d9d to your computer and use it in GitHub Desktop.
hosts js file
/**
* Mark attendance activation after email send callback
*/
function toggleEventAttendance() {
$('.email-sent-btn').on('click', function(e) {
e.preventDefault();
console.log(e);
var form = $(e.target.form);
$.ajax({
type: form.attr('method'),
url: form.attr('action'),
data: form.serialize(),
dataType: 'json', //Not sure why this is required
success: function(data) {
var id = data.tea_time.id;
$("[data-tea-time-id='"+id+"'] > h3.tasks.email").attr('class', 'tasks email complete')
$(e.target).parents('.subtask-container').html("<p class='subtask'>All done, thanks!</p>")
},
error: function(data) { alert('Uh-oh. You shouldn\'t be seeing this.'); }
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment