Skip to content

Instantly share code, notes, and snippets.

@benw
Created April 5, 2013 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benw/5318523 to your computer and use it in GitHub Desktop.
Save benw/5318523 to your computer and use it in GitHub Desktop.
$('button.accept-terms').click(function (e) {
$(e.target).attr('disabled', 'disabled');
$.ajax({
type: 'POST',
url: '/settings',
data: {
_csrf: window._csrf,
accept_terms: true
},
success: function (data, textStatus, jqXHR) {
window.terms_accepted = true;
$('#termsModal').modal('hide');
if (inputToFocus) $(inputToFocus).focus();
},
error: function (jqXHR, textStatus, errorThrown) {
$(e.target).removeAttr('disabled');
console.log('POST /settings error: ' + textStatus + ' - ' + errorThrown);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment