Firebug indicates I have a TypeError: a.ownerDocument is undefined
with this code:
$(this).text('Updated!').fadeOut('900', function() {
$(this).text('Update').attr('disabled', 'disabled').show()
});
A more complete snippet follows:
$(".update-role").click(function() {
var newRole = $(this).prev().val();
var userId = $(this).parents('tr').attr('id'); // e.g. 'user-role-18'
userId = userId.split('-');
userId = userId[2]; // so we get '18'
$.getJSON('services/update_staff_role.php', {r: newRole, id: userId}, function(j) {
if(j.result == 'success') {
$(this).text('Updated!').fadeOut('900', function() {
$(this).text('Update').attr('disabled', 'disabled').show()
});
} else {
alert(j.reason);
}
});
console.info(userId, newRole);
});
Could it be because I'm using this
, because I'm using a callback
inside another callback
?