Skip to content

Instantly share code, notes, and snippets.

@nanobeep
Created October 7, 2010 16:16
Show Gist options
  • Save nanobeep/615374 to your computer and use it in GitHub Desktop.
Save nanobeep/615374 to your computer and use it in GitHub Desktop.
$('#coupon').blur(function() {
var coupon = $(this);
$.ajax({
'url':'/coupon/check',
'data': {'coupon' : $(this).val() },
'dataType':'json',
'type':'POST',
'success':function(r) {
if (r.error) {
$('#coupon_input label').addClass('error');
} else {
$('#coupon_input label').removeClass('error');
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment