I am doing some AJAX when a button is clicked
$btn.button('loading');
$.ajax({
type: 'PUT',
url: 'event/',
data: put_data,
dataType: 'json',
success: function(data){
if (data.redirect) {
window.location = data.redirect;
}
else {
$btn.button('reset');
if ($btn.is('#my-btn')) {
console.log('disabling button');
$btn.prop('disabled', true);
}
}
}
});
disabling button
shows up in the console, but the button does not get disabled. Loading and resetting the button works just fine. I tried .addClass('disabled')
and .attr('disabled','disabled')
, but those also don't work.
See here: http://codepen.io/anon/pen/Wvbeeg