mastanggt, попробуй так:
<style>
tr.active{background:#FFFACD}
div.rulesForEvents{display:none;margin-left:35px;}
</style>
<script>
$('button.tableGetRules').click({x:0},function(e){
if (e.data.x != this) {
if (e.data.x) {
$(e.data.x)
.closest('tr')
.removeClass('active')
.next()
.find('.rulesForEvents')
.slideUp(500,function(){
$(this).closest('tr').remove();
});
}
var $btn = $(this);
var $act = $btn.closest('tr').addClass('active');
$.post(
'tableEvents/getRules/',
{ event_id: $btn.data('id') },
function(data){
if (data['errors']) {
alert(data['errors']['event_id']);
return;
}
$act.after('<tr class="active"><td colspan="4"><div class="rulesForEvents">'+data+'</div></td></tr>')
.next()
.find('.rulesForEvents')
.slideDown(500);
});
e.data.x = this;
}
});
</script>